[time-nuts] Cheap jitter measurements

Dan Kemppainen dan at irtelemetrics.com
Tue Apr 10 17:05:45 EDT 2018

Hi Bob,

The performance counter does not use the system time calls, NTP, etc. 
It's an independent counter clocked from raw CPU clock. So you have a 
~300pS Timestamping counter in the processor. Why not use that hardware 
to do the measurement? Does the signal have to exit the PC to measure it?

Yes, getting ~300pS out of the code calls is probably unrealistic for 
various reasons, however 300nS should be easily achievable.

If you use the actual NTP PPS capture code with a few extra lines of 
code added, you should be able to timestamp PPS and NTP values against 
the performance counter.


Correct me if I'm wrong, but the issue with the GetSystemTime calls is 
they don't use the performance counters. They are system time related 
calls and affected by UTC/NTP or other system time adjustments.

The bigger questions is how does NTP query the serial port? Is it in an 
actual interrupt routine, or is the data captured via software driven 
event? (I'm betting on a OS driven event).

Maybe the Dave Hart patches improve the PPS capture???

The bottom line is it all depends on now the PPS Capture event is 
handled, and if that's even predictable enough or stable enough to prove 
useful. The performance counter is, but getting the PPS code to read the 
counter is still a software problem.

If you guys want to take this offline and chat about it further, I'd be 
happy to discuss this without using up bandwidth here.


On 4/10/2018 4:01 PM, time-nuts-request at febo.com wrote:
> Dan,
> Take a look at Dave Hart's patches to the Microsoft serial port driver, that
> does something similar.  The source may be in the NTP distribution, or
> Meinberg may have a copy.  At one time using the QueryPerfomanceCounter call
> was an option (look for "QPC").  With Windows-8 and later there is a much
> more precise GetSystemTime call which NTP uses.
> I played a little with those calls (in a non-serious way) and wrote some
> code:
>    http://www.satsignal.eu/ntp/TSCtime.html
> based on:
>    http://www.lochan.org/2005/keith-cl/useful/win32time.html
> and just messing around!  Perhaps it's of interest or use?
> Cheers,
> David
> -- SatSignal Software - Quality software written to your requirements 
> Web: http://www.satsignal.eu Email: david-taylor at blueyonder.co.uk 
> Twitter: @gm8arv

More information about the time-nuts mailing list