[ntp:questions] Building FreeBSD V8.0 kernel for PPS

unruh unruh at wormhole.physics.ubc.ca
Fri Apr 16 00:51:46 UTC 2010

On 2010-04-15, Chuck Swiger <cswiger at mac.com> wrote:
> On Apr 14, 2010, at 9:51 PM, unruh wrote:
>>> Kernel PPS_SYNC discipline is capable of providing around +/- 120 nanosecond accuracy.
>>> While an ethernet packet containing NTP timestamps might well fire off an interrupt from the NIC, not only is the network ISR a lot more complicated and slower than fielding an interrupt from the serial or parallel port, there's also no guarantee that ntpd running in userland will immediately receive and process this information.  For another thing, modern NICs tend to do some degree of interrupt mitigation, which adds delay.
>> No I meant serial or parallel port interrupts. The standard drivers for
>> these will process the interrupts and you can time stamp them.
> Timestamp using what?

You local clock. That then tells you the time difference between pps and
your local clock.

> If you truly have a local timesource which is more accurate than the PPS signal, of course you should use it, but none of the clocks found on standard x86 hardware are going to be anywhere close.  The point of the PPS kernel discipline is to compare your less precise local clock to a more precise, interrupt-driven signal, and fine-tune the adjtime()/adjtimex()/etc adjustments being made to a greater level of accuracy than is possible to obtain from userland.
> Regards,

??? The PPS is your good time. The timestamps are your time that you
want to correct. Note that it is entirely possible to do it from
userland-- you look at the difference between PPS and the local clock
and tell adjtimex to correct it.

Of course you have to use a kernel routing to do the correction--
adjtimex. But you do not need the kernel land to figure out how much of
a correction to take, to filter the input for clearly stupid values (
like the PPS firing 10 times in one second), running the median filter,
etc. Once  you know what the difference is between pps and your system
clock you can then use adjtimex to adjust the system clock to bring it
into sync with the PPS.

More information about the questions mailing list