[ntp:questions] Re: How application get precise time from Win NT/XP system time that synchronies to NTP
Roger Chou ???
rgchou at ms46.hinet.net
Wed Mar 30 07:42:40 UTC 2005
If my application polls the system time once every tick, i.e. 10
millisecond, can I get nanosecond resolution and accuracy that NTP can
"Martin Burnicki" <martin.burnicki at meinberg.de> ???
news:76nnh2-6js.ln1 at gateway.py.meinberg.de ???...
> Roger Chou wrote:
> > My applications is to do time stamp that need 10 microsecond accuracy.
> > Many PCs in network environment will need ssme precise time stamp. One
> > to do it is to install Trimble Acutime GPS for each PC. Because of cost
> > consideration, I installed a Win NT NTP server that use Trimble Acutime
> > GPS as reference clock and the rest of PCs synchronize to the server and
> > try to find a way to get precise time from NT/ XP system. I head NT/XP
> > system time can only reach 10 millisecond resolution, if it is true? Or
> > there is another way to do it.
> The Windows API to read the system time provides a resolution of
> nanoseconds. However, the value returned by those APIs is updated once
> every timer tick, so if your application polls the system time
> continuously, it will read the same time between two ticks, and after each
> tick it will find the system time has been incremented by the tick
> interval, i.e. 10 or 15 milliseconds.
> In order to increase the resolution of the Windows system clock beyound
> tick interval, the NTP service under Windows runs a special high priority
> thread which interpolates the time between two clock ticks using the
> Windows performance counter API. Unfortunately, you are unable to access
> that interpolated time from your application.
> Even worse, if you start any application that uses the Windows multimedia
> timer API and sets the multimedia timers to highest resolution of 1
> millisecond, the normal system clock is delayed by 10 to 20 milliseconds
> long as that application is running. You can simply test it by letting NTP
> adjusting your system time until synchronization has settled, then start
> such an application like Quicktime, and use the ntpq command to see how
> offset suddenly changes by several milliseconds if you start Quicktime,
> the offset falls back close to the initial value if you exit Quicktime.
> Note that this is _not_ a problem of Quicktime, neither of NTP, but of the
> implementation of the Windows system clock, and task scheduling.
> Meinberg provides GPS PCI cards which provide an API which lets your
> application read time stamps with better than 1 microsecond resolution and
> accuracy directly from the board.
> The API call even accounts for the latency due to the execution time of
> driver when calling the device driver to access the PCI board.
> Martin Burnicki
> Meinberg Funkuhren
> Bad Pyrmont
More information about the questions