Clock drift in gnat 3.13p on Windows 
Author Message
 Clock drift in gnat 3.13p on Windows

I have an Ada application compiled with gnat 3.13p.  It runs on NT
or Windows 2000 PC that gets periodic clock updates via NTP.  

When the program first starts up Ada.Calendar.Clock, Ada.Real_Time.Clock
and Win32.Winbase.GetLocalTime all agree on the time.  After the
program has run for a few hours and the PC has gotten a few NTP
time updates, GNAT's idea of the current time is off by a second
or two.

I'd like to periodically update the GNAT runtime system's idea of
the current time.  Would it be sufficient to periodically adjust
the value of Base_Clock and Base_Ticks in System.OS_Primitives?

--
=======================================================================
 Life is short.                  | Craig Spannring

 --------------------------------+------------------------------------



Wed, 16 Jul 2003 05:45:00 GMT  
 Clock drift in gnat 3.13p on Windows

Quote:

> I have an Ada application compiled with gnat 3.13p.  It runs on NT
> or Windows 2000 PC that gets periodic clock updates via NTP.  

> When the program first starts up Ada.Calendar.Clock, Ada.Real_Time.Clock
> and Win32.Winbase.GetLocalTime all agree on the time.  After the
> program has run for a few hours and the PC has gotten a few NTP
> time updates, GNAT's idea of the current time is off by a second
> or two.

Well GNAT is using the High Performance Counter under NT to achieve high
resolution but this counter is certainly not updated by NTP updates...

Quote:
> I'd like to periodically update the GNAT runtime system's idea of
> the current time.  Would it be sufficient to periodically adjust
> the value of Base_Clock and Base_Ticks in System.OS_Primitives?

Well, looking at the implementation it should work :)
But you'll have to break the encapsulation of Base_Clock...

Pascal.

--

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



Wed, 16 Jul 2003 06:24:40 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. problems installing gnat 3.13p on Windows 2000?

2. ObjectAda - no clock drift!

3. GNAT memory leak in compiled code (3.13p/Linux)

4. A Bug about GNAT 3.13p

5. problems making OpenGL with Gnat 3.13p

6. Inlining issues (GNAT 3.13p, OA 7.2.1)

7. change colors in GtkAda (Linux/GNAT 3-13p-7)

8. Recompiling Glade from sources on RedHat Linux 6.2 (GNAT 3.13p-7)

9. GNAT 3.13p binaries for OS/2 available

10. Can't redirect output from gnat-3.13p-nt

11. Compilation halts on GNAT 3-13p, RedHat6.2 Linux

12. GNAT 3.13p build for Solaris 8_x86

 

 
Powered by phpBB® Forum Software