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

James Gibb jamesgibb at clannet.co.uk
Mon Apr 14 13:48:18 UTC 2014

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 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.


----- Original Message -----
From: Charles Elliott <elliott.ch at verizon.net>
To: 'James Gibb' <jamesgibb at clannet.co.uk>
Cc: questions at lists.ntp.org
Sent: Mon, 14 Apr 2014 13:54:04 +0100 (BST)
Subject: RE: [ntp:questions] Windows: SerialPPS Performance Counter/Processor Cycle Counter offset issue

FWIW, I found that both my Windows 7 and Windows 8 machines were using 
the RTC to drive the Performance Counter (PC).  On a Windows machine, 
you can tell what counter is driving the PC by looking at the line
"Performance counter frequency X.XXXXX MHz" in the Event Log, put 
there by ntpd when it is starting up.  If the X's = 3.516 then I 
believe it is using the RTC, but if the X's are 14.318 MHz, then 
it is using the HPET.  The latter should be more accurate
since it corresponds to a period of ~70 ns, while the former 
has a period of ~284 ns.

In Windows 7 & 8, to make the PC use the HPET, run cmd as admin 
and paste "bcdedit /set {current} useplatformclock Yes".

Charles Elliott

-----Original Message-----
From: questions-bounces+elliott.ch=verizon.net at lists.ntp.org
[mailto:questions-bounces+elliott.ch=verizon.net at lists.ntp.org] On Behalf Of
James Gibb
Sent: Monday, April 14, 2014 8:21 AM
To: questions at lists.ntp.org
Subject: [ntp:questions] Windows: SerialPPS Performance Counter/Processor
Cycle Counter offset issue

I've found that an offset can be introduced when using SerialPPS on Windows
XP/2003.  Unless --usepcc is specified, NTPD will likely add an offset to
the PPS timestamps caused by the difference between times worked out within
NTPD and externally, i.e. the timestamping of the DCD events in the
SerialPPS.sys driver.  I've submitted a bug for this, 2599.  I'd be
interested to know if other Windows systems suffer the same problem.
questions mailing list
questions at lists.ntp.org

More information about the questions mailing list