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,ff7d8060c8210f40 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news4.google.com!news.glorb.com!peer1.news.newnet.co.uk!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: real_time.clock is not monotonic Date: Wed, 21 Feb 2007 20:17:15 +0000 Organization: Pushface Message-ID: References: <1172074608.834181.198540@j27g2000cwj.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1172089037 18408 62.49.19.209 (21 Feb 2007 20:17:17 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Wed, 21 Feb 2007 20:17:17 +0000 (UTC) Cancel-Lock: sha1:Ga8sXpc1lYXIQ/gpUNMjoZlI9xE= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (darwin) Xref: g2news2.google.com comp.lang.ada:9379 Date: 2007-02-21T20:17:15+00:00 List-Id: frederic.ormancey@atosorigin.com writes: > I'll alert Gnat community with this bad implementation, as > gettimeofday() is affected by NTP and others date adjustements. in > LRM, Ada.Real_Time.Clock shall be monotonic => Gnat runtime is not > compliant I reported this with GNAT 3.16, not sure if there's a solution yet. > Did someone have a solution for this problem ? another implementation > using a Linux monotonic clock ? The Booch Components have a clock that might be a possibility: OK on Windows and Linux (not sure about Solaris x86, no idea for 64-bit OSs): with System.Machine_Code; separate (BC.Support.High_Resolution_Time) function Clock return Time is type Half is (Low, High); Lower, Upper : Interfaces.Unsigned_32; Results : array (Half) of Interfaces.Unsigned_32; Result : Time; for Result'Address use Results (Low)'Address; begin System.Machine_Code.Asm ("rdtsc" & ASCII.LF & ASCII.HT & "movl %%eax, %0"& ASCII.LF & ASCII.HT & "movl %%edx, %1", Outputs => (Interfaces.Unsigned_32'Asm_Output ("=g", Lower), Interfaces.Unsigned_32'Asm_Output ("=g", Upper)), Clobber => "eax, edx", Volatile => True); Results := (Low => Lower, High => Upper); return Result; end Clock;