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: 103376,349427c451f66022,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: michael bode Newsgroups: comp.lang.ada Subject: Strange behaviour of delay in Windows XP Date: Thu, 07 Oct 2010 23:04:33 +0200 Organization: A noiseless patient Spider Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Injection-Date: Thu, 7 Oct 2010 21:04:34 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="LsJMQgeB2+MUtf72DDdSBQ"; logging-data="15378"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19yAM7qjqB3CdFE/2ZOHAEhQ494HSDlWlc=" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 Cancel-Lock: sha1:M+0nFVCmtpGktWPfX66fDZ7Kn7g= Xref: g2news1.google.com comp.lang.ada:14423 Date: 2010-10-07T23:04:33+02:00 List-Id: 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?