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

Maximilian Brehm maximilian.brehm at tu-ilmenau.de
Wed Apr 30 12:05:34 UTC 2014


From: Rob <nomail at example.com>
> 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.
But how to detect whether the time was set correctly (in or out of the
application)? Or how do I get the absolute timestamps of the various
peers?

I misused terminology. I did not write a reference clock driver in NTP
but an external application that uses the shared memory reference clock
driver. It does not provide a PPS signal currently and to provide it is
a hack (since it is not a device but an application that reads the
timestamps from packages).

As mentioned before the clock seems to be stable when the application
uses the own clock for an offset but now I would like to set the offset
using an external source. I could probably query the external server
itself.
> 
> 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).
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions
> 
> End of questions Digest, Vol 114, Issue 63
> ******************************************



More information about the questions mailing list