[ntp:questions] Best solution for millisecond accuracy

Martin Burnicki martin.burnicki at meinberg.de
Mon Mar 26 07:29:25 UTC 2007


Danny,

Danny Mayer wrote:
> David Woolley wrote:
>> In article <46043069.1010200 at comcast.net>,
>> Richard B. gilbert <rgilbert88 at comcast.net> wrote:
>>> edouard funke wrote:
>> 
>>>> - change OS (again what is the impact ?)
>>> Some operating systems keep time a little better than others.  Windows
>>> and Linux have both been known to lose clock interrupts during periods
>>> of high disk usage.  I've had good results with Solaris (8, 9, & 10) but
>>> others here seem to have had results differing from mine!
>> 
>> Also, Windows, in default configuration, will only provide a resolution
>> of about 15 to 20ms (whatever the clock interrupt rate is) in the times
>> provided to application programs.  ntpd plays tricks to make its own
>> times more accurate, and therefore the phase of the system clock more
>> accurate, but, in my experience, that breaks down when the system is
>> heavily loaded.
>> 
>> It is possible that enabling multimedia timers will improve the
>> resolution of time supplied to application programs; I haven't tested
>> this.
> 
> The Windows implementation uses the multimedia timers to provide the
> greatest accuracy.

Not quite. It uses the PerformanceCounter API to interpolate between timer
ticks. The PerformanceCounter API traditionally gets its time stamps from
the timer chip, or from the CPU's time stamp counter (TSC), depending on
the HAL which is installed on the particular machine. 

AFAIK there are some even more different HALs available on very recent
Windows versions. 

The multimedia timers are only (optionally) set to highest resolution by the
Windows port of ntpd because otherwise the Windows system time would seem
to step back and forth whenever another program on that machine would
change the MM timer.

BTW, first tests with Vista showed that the Windows system clock resolution
has been increased to 1 millisecond under Vista. However, the MM timer
issues are still present.


Martin 
-- 
Martin Burnicki

Meinberg Funkuhren
Bad Pyrmont
Germany




More information about the questions mailing list