[ntp:questions] Accuracy of NTP - Advice Needed

Dave Hart davehart at gmail.com
Fri Dec 23 18:06:56 UTC 2011


On Fri, Dec 23, 2011 at 17:02, Terje Mathisen <"terje.mathisen at
tmsw.no"@ntp.org> wrote:
> A fast system time query will load the time as of the last hw clock tick,
> along with the corresponding RDTSC (or similar, constant-rate highres clock
> source), load the current RDTSC value, then re-read the OS tick.
>
> If the OS tick has been updated in the meantime, restart the process.
>
> Finally, scale the RDTSC delta by the (OS-provided) frequency and add to the
> tick time: The result is the current system time in ~100 clock cycles, with
> sub-us precision.

That's a good description of most OS clocks.  There are exceptions
where no high-resolution counter is used, such as often seen with ntpd
on Windows Vista and later.  On such systems, reading the clock can be
as fast as reading 64 bits from shared memory, possibly twice if
partial updates are visible.

Cheers,
Dave Hart


More information about the questions mailing list