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

David Woolley david at djwhome.demon.co.uk
Sat Mar 26 20:02:24 UTC 2005


In article <mailman.0.1111835963.588.questions at lists.ntp.isc.org>,
Roger Chou <rgr.chou at gmail.com> wrote:

> My applications is to do time stamp that need 10 microsecond accuracy. Many

The only thing that you will timestamp to that accuracy on a general
purpose OS is the reading of the cycle counter or the residual count
in the CTC.  NT is probably one of the worst OSes in this respect, as it
has a reputation for losing clock ticks, which means interrupt latencies of
over 10 milli-seconds.

You need a special purpose hard real time operating system, with fully
pre-emptive scheduling and even then you will need to evaluate the 
consequences of interrupt latencies.

You may need special hardware that timestamps the external event so as
to remove the time dependency in subsequent processing.

(If you disable interrupts (not an option for application level code on NT)
you can avoid the latencies in timing outgoing events, but you can't,
sensibly, disable interrupts for detecting incoming events (unless they always
follow an outgoing event by only about a milli-second), without destroying the
operating system's ability to function.  You would have to be a device driver
to disable interrupts on NT.)

You may well need the full source code of the OS to work to 10 microseconds
(NTP may manage to keep time to that accuracy, but only because its corrections
are averaged over a long period of time).




More information about the questions mailing list