[ntp:questions] Re: How application get precise time from Win NT/XP system time that synchronies to NTP

mayer at gis.net mayer at gis.net
Wed Mar 30 14:02:55 UTC 2005


----- Original Message Follows -----
> Martin,
> 
> If my application polls the system time once every tick, i.e. 10
> millisecond, can I get nanosecond resolution and accuracy that NTP can
> provide?
> 

The simple answer is no way. The more complicated answer is that you
would
need an real atomic clock directly connected on a machine running a
realtime O/S with absolutely no other processes that the absolute
essential
ones. Windows wouldn't even be in the picture here, it's not designed
for
what you are asking.

What exactly are you trying to do and why? A little explanation would
greatly help in our being able to provide advice.

Danny

> Roger
> 
> "Martin Burnicki" <martin.burnicki at meinberg.de> ???
> news:76nnh2-6js.ln1 at gateway.py.meinberg.de ???...
> > Roger,
> >
> > 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 way
> > > 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 I
> > > 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 that
> > 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 as
> > 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 the
> > offset suddenly changes by several milliseconds if you start
> Quicktime, and
> > 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 the
> > driver when calling the device driver to access the PCI board.
> >
> > Martin
> > -- 
> > Martin Burnicki
> >
> > Meinberg Funkuhren
> > Bad Pyrmont
> > Germany
> 
> 
> _______________________________________________
> questions mailing list
> questions at lists.ntp.isc.org
> https://lists.ntp.isc.org/mailman/listinfo/questions



More information about the questions mailing list