From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,134ffece5bb64502 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.71.MISMATCH!xlned.com!feeder3.xlned.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Strange behaviour of delay in Windows Date: Tue, 26 Oct 2010 03:08:03 +0200 Organization: Ada @ Home Message-ID: References: NNTP-Posting-Host: o1huFJB2ANcHlWoNFASSiA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.63 (Win32) Xref: g2news1.google.com comp.lang.ada:14768 Date: 2010-10-26T03:08:03+02:00 List-Id: Le Thu, 07 Oct 2010 19:35:36 +0200, Michael Bode a =C3= =A9crit: Unless the compiler conforms to the Real-Time Annex D, this accuracy is = = implementation defined, which you can understand as =E2=80=9Csee the com= piler = manual instead of the reference=E2=80=9D or alternatively as =E2=80=9Cyo= u cannot assert = anything=E2=80=9D. This all said in 9.6(20) of the Ada 2005 RM : The time base associated with relative delays is as defined in D.9, =E2=80=9CDelay Accuracy=E2=80=9D or is implementation defined. I know Dmitry Kazavov may have something to say about tasking and timing= = in the Windows operating system. To push the test further, did you tried a =E2=80=9Cdelay until =E2=80=A6= =E2=80=9D statement, just = to see ? > 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 :=3D 1.0; > T1 :=3D Clock; > delay D; > T2 :=3D 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 actu= al > delay of about 2.7s instead. I tried with GNAT GPL 2008 and 2009. Ther= e > was no noticeable CPU load during the test. To make things more > interesting, a different machine (Vostro MT 230, same RAM, same CPU, s= ame > 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 time= s > as printed above: 1.000xxx seconds. > > Any ideas? -- = Si les chats miaulent et font autant de vocalises bizarres, c=E2=80=99es= t pas pour = les chiens.