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

William Unruh unruh at invalid.ca
Wed Apr 30 16:30:13 UTC 2014

Googlegroups adds extra blank lines making posts rapidly unreadable.
Your gets rid of all line breaks and then breaks the lines in random
places. That is also very hard to read. 

On 2014-04-30, Maximilian Brehm <maximilian.brehm at tu-ilmenau.de> wrote:
> On 2014-04-30, William Unruh  wrote:
> >On 2014-04-30, Maximilian
> Brehm  wrote: >> >> >> Hey, >> >> for my application (external to ntpd)
> I would like to extract >> the reference times of the peers ntpd
> synchronizes with. Of course, >> there is ntpdc that shows me the
> estimated offsets of the different >> reference clocks to the system
> clock. Are there other more efficient >> ways? If not, would you
> recommend me code segments in ntpd to extract >> this kind of data (by
> writing the methods myself)? > >The system time of your system is the
> best that ntpd can do to get the >reference times of the peers. So just
> use the system time. >NOt sure what it is that you need to do this for.
> 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

It is very unclear what your mean (and I do not just mean the
formatting). Is this an external clock to the computer? Do you at least
know that the clock starts on the second, or is the start time unknown
even to the microsecond level? Why do you want to use that clock?
"It works well when setting its offset to the system clock"
What works well? Are you trying to get that relative clock to have the
correct time, or is it providing the time? 

Yes, ntpd would find it very very difficult to use that clock as a
reference. A PPS signal which has not seconds marker, at least is know
to be accurate to the ms, and it can be used to discipline the system
clock to the ms, if something else disciplines the seconds. Your give
nothing except the rate, and ntpd uses only the offset to determine the

> Links:
> ------
> [1] mailto:unruh at invalid.ca

More information about the questions mailing list