comp.lang.ada
 help / color / mirror / Atom feed
From: michael bode <m.g.bode@web.de>
Subject: Strange behaviour of delay in Windows XP
Date: Thu, 07 Oct 2010 23:04:33 +0200
Date: 2010-10-07T23:04:33+02:00	[thread overview]
Message-ID: <i8lcl2$f0i$1@news.eternal-september.org> (raw)

Hi,

I've seen a very strange behaviour of the delay statement with GNAT on a
Windows XP machine. This is the code:

with  Ada.Text_Io; use Ada.Text_Io;
with Ada.Calendar; use Ada.Calendar;

procedure Testprog is
   T1, T2 : Time;
   D : Duration;
begin
   D := 1.0;
   T1 := Clock;
   delay D;
   T2 := Clock;
   Put_Line ("Expected delay:" & Duration'Image(D));
   Put_Line ("Actual delay:" & Duration'Image(T2-T1));
end Testprog;

And this is what it prints when run on Linux:

Expected delay: 1.000000000
Actual delay: 1.000321000

But I have a (or rather 2) Dell Vostro MT 220 PC where the actual delay
is about 2.7s instead. Tested with GNAT GPL 2008 and 2009 on XP. Another
almost identical Vostro MT 230 works as expected. And to make it more
interesting when I brought the Vostro 220 from my lab to my office it
worked as expected. Back to the lab I got the 2.7s delay again. Most of
the time. Sometimes I got 1.0xxs. There was no noticeable CPU load
during the tests. Then I booted the machine from a Ubuntu Live CD and
tested with the program compiled under Debian Lenny. It worked as
expected: 1.000xxx seconds delay.

Any ideas or should I call a feng shui master?



             reply	other threads:[~2010-10-07 21:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07 21:04 michael bode [this message]
2010-10-07 21:35 ` Strange behaviour of delay in Windows XP Vinzent Hoefler
2010-10-07 22:10   ` michael bode
2010-10-07 22:37 ` Jeffrey Carter
2010-10-08  5:18   ` michael bode
2010-10-08 10:13   ` michael bode
2010-10-08  0:15 ` Randy Brukardt
2010-10-08  5:33   ` michael bode
2010-10-09  6:42     ` Randy Brukardt
2010-10-09  8:18       ` Dmitry A. Kazakov
2010-10-26  1:50   ` Yannick Duchêne (Hibou57)
2010-10-08  7:54 ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox