comp.lang.ada
 help / color / mirror / Atom feed
* Strange behaviour of delay in Windows
@ 2010-10-07 17:35 Michael Bode
  2010-10-10 10:02 ` michael bode
  2010-10-26  1:08 ` Yannick Duchêne (Hibou57)
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Bode @ 2010-10-07 17:35 UTC (permalink / raw)


I would expect the delay statement to delay execution for the given
time. So with this 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;

I'd expect to get this result:

Expected delay: 1.000000000
Actual delay: 1.000239000

But on one Windows machine (a Vostro MT 220, Windows XP) I get an actual
delay of about 2.7s instead. I tried with GNAT GPL 2008 and 2009. There
was no noticeable CPU load during the test. To make things more
interesting, a different machine (Vostro MT 230, same RAM, same CPU, same
Windows XP version) works as expected. And to make things even more
interesting, the Vostro MT 220 normaly lives in the lab. When I found
this bug I carried it over to my office to check things. In the office
it worked ok. Back to the lab and I got the 2.7s, most of the time. A
couple of times I got 1.0xxx seconds. 

Then I compiled the program statically linked on Debian, put a Ubuntu
Live CD in the machine and tried my program. Result was dozens of times
as printed above: 1.000xxx seconds.

Any ideas?



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-26  1:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-07 17:35 Strange behaviour of delay in Windows Michael Bode
2010-10-10 10:02 ` michael bode
2010-10-11 19:00   ` Adam Beneschan
2010-10-11 19:05     ` Vinzent Hoefler
2010-10-26  1:08 ` Yannick Duchêne (Hibou57)

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