[ntp:questions] questions Digest, Vol 114, Issue 25

James Gibb JamesGibb at clannet.co.uk
Mon Apr 14 19:50:53 UTC 2014

> Date: Mon, 14 Apr 2014 18:23:56 +0200
> From: Terje Mathisen <terje.mathisen at tmsw.no>

> 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


Sorry, I was abbreviating when I put SystemTimePrecise, I was referring to  
GetSystemTimePreciseAsFileTime just as you say, as distinct from the old  
GetSystemTimeAsFileTime.  And yes, I was wrong about the precise version  
being introduced in Win7; it's new to Win8 as you say.

So you think GetSystemTimeAsFileTime should always have interpolated  
anyway?  I assume when you say that bug is fixed in Win8, you're referring  
to GetSystemTimePreciseAsFileTime since GetSystemTimeAsFileTime still  
doesn't interpolate does it?

Is there still a need to tie the timing threads in Windows 7/8 to a single  
processor?  The MSDN makes it sound as though the TSC should be identical  
across multiple processors.

It also says the QPC frequency is unaffected by power saving CPU clock  
mode changes so it would seem there's no need to have the direct _rdtsc  
option instead of just relying on QPC these days.


Using Opera's mail client: http://www.opera.com/mail/

More information about the questions mailing list