[ntp:questions] Best ways to get the reference times from ntp

Rob nomail at example.com
Wed Apr 30 10:54:46 UTC 2014


Maximilian Brehm <maximilian.brehm at tu-ilmenau.de> wrote:
> This is related to another questions by me a few weeks ago. I wrote a
> reference clock driver that uses a clock that only provides timestamps
> relative to its starting point. It works well when setting its offset to
> the system clock via CLOCK_REALTIME and clock_gettime to stabilize the
> system clock. I would now like to include external ntp server. I can not
> be sure that the system time is within millisecond range of the
> reference time.
> As far as I understood the ntp algorithms (especially
> the select phase), if I continue to set the offset relative to the
> system time my clock would be identified as false ticker at least in the
> early phase of the algorithm. >> >> Regards >> >> >> Maximilian
> Brehm

I think it is similar to the problem faced by gpsd and the ATOM
reference clock.  The trick in those clocks is to use a "gate" that
enables the clock only after ntpd has synchronized with another
clock on the network that provides absolute time.

But in the above case, the problem is only that PPS provides information
about the time a second starts, but no numbering of the seconds.
So you only need to bring the clock within a few hundred ms of the
correct time, then enable the "gate" of the PPS refclock and the clock
will finetune to the PPS clock.

In your case you will need to have a good lock on a reliable external
clock, and only *then* you take the timestamp and enable the gate
of your refclock.

When you don't do that, the ntpd will simply ignore your refclock
because it is a falseticker (a clock providing incorrect time).



More information about the questions mailing list