[ntp:questions] Windows: SerialPPS Performance Counter/Processor Cycle Counter offset issue

Terje Mathisen terje.mathisen at tmsw.no
Mon Apr 14 16:23:56 UTC 2014


James Gibb wrote:
> MSDN suggests that the Performance Counter is based on a processor
> Time Stamp Counter (TSC aka PCC) for Windows 7/8.  Access to that is
> low latency since it's within the CPU.  Access to other timers such
> as the HPET is a lot slower since it involves I/O to the motherboard.
> So although you've got a higher frequency it may not actually produce
> more accurate results for NTPD?
>
> On Win7 and 8 SystemTimePrecise is available so I don't think NTPD

Are you sure that is the API name? Google have never heard about it...

> would be using the Performance Counter anyway since the OS will
> provide the time accurate (or at least, precisely) to 100ns anyway
> without the need to interpolate from a much more granular
> GetSystemTimeAsFiletime() call.

AFAIK, Win8 was the first to fix the longstanding HAL bug, where 
GetSystemTimeAsFiletime() would _not_ interpolate. It was precisely due 
to the fact that the low-level hw clock code was abstracted away in the 
HAL that it took ~20 years to fix the problem.

Anyway, Win8 have GetSystemTimePreciseAsFileTime() which does implement 
exactly the same kind of sw interpolation as pretty much all other 
server & desktop OSs have had for decades.

Terje
-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"



More information about the questions mailing list