comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon.j.wright@mac.com>
Subject: Re: real_time.clock is not monotonic
Date: Wed, 21 Feb 2007 20:17:15 +0000
Date: 2007-02-21T20:17:15+00:00	[thread overview]
Message-ID: <m2vehvmfjo.fsf@mac.com> (raw)
In-Reply-To: 1172074608.834181.198540@j27g2000cwj.googlegroups.com

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;



  parent reply	other threads:[~2007-02-21 20:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-21 16:16 real_time.clock is not monotonic frederic.ormancey
2007-02-21 19:46 ` Georg Bauhaus
2007-02-21 20:33   ` Michael Bode
2007-02-21 20:17 ` Simon Wright [this message]
2007-02-22  9:50   ` Duncan Sands
2007-02-22 10:34     ` Simon Wright
2007-02-22 10:53       ` Duncan Sands
2007-02-22 20:48         ` Simon Wright
2007-02-26  8:50   ` Florian Weimer
2007-02-26 20:59     ` Simon Wright
2007-02-22  2:05 ` Adam Beneschan
2007-02-22  2:34   ` Randy Brukardt
2007-02-22  3:19     ` Adam Beneschan
2007-02-22 11:04     ` [OT] Broken threading (was RE: real_time.clock is not monotonic) Alex R. Mosteo
2007-02-22 11:39       ` Georg Bauhaus
2007-02-22 14:52         ` Alex R. Mosteo
2007-02-23  0:43       ` Randy Brukardt
2007-02-23 10:11         ` Alex R. Mosteo
2007-02-25  0:39           ` [OT] Broken threading Björn Persson
2007-02-26  8:50             ` Alex R. Mosteo
2007-02-27  0:13             ` Randy Brukardt
replies disabled

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