comp.lang.ada
 help / color / mirror / Atom feed
From: Michael Bode <m.g.bode@web.de>
Subject: Strange behaviour of delay in Windows
Date: Thu, 07 Oct 2010 19:35:36 +0200
Date: 2010-10-07T19:35:36+02:00	[thread overview]
Message-ID: <i8l0d9$ia6$1@online.de> (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?



             reply	other threads:[~2010-10-07 17:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-07 17:35 Michael Bode [this message]
2010-10-10 10:02 ` Strange behaviour of delay in Windows 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)
replies disabled

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