[ntp:questions] Re: Reading time offset from ntp variables using ntpq

David L. Mills mills at udel.edu
Wed Feb 15 14:44:50 UTC 2006


As to which timestamp is "correct" you will need to read the 
architecture briefing on the NTP project page. While at it, understand 
the raw offset measurement does not reflect the actual clock offset, as 
the latter is determined by the clock discipline algorithm described in 
the briefings on the project page. The discipline acts as a lowpass 
filter where the real offset is typically a fraction of the measured 
offset, usually in the order of a thousand times smaller. To justify 
that claim, it is necessary to plow the mathematics of phase-locked 
loops. One of the appendices of rfc1305 and any of several documents 
listed on the project page explores these things.


Daniel Kabs wrote:
> Hello!
> David L. Mills wrote:
>> The peer offset is recorded for each client/server exchange. Let it 
>> run for a few hours and record the time of day and the offsets at the 
>> beginning and end. Subtract and divide by the interval. It's really 
>> not complicated.
> "record the time of day" sounds easy, but it is not if I want to measure 
> with good precision. Actually that's everything NTP is about and it 
> takes a lot to get the time right :-)
> I have NTP running using the option "disable ntp". I read the time 
> offset using ntpq -c 'rv <assoc_id_of_peer>' at two points in time.
> Example:
> # ntpq -c "rv 32468"
> assID=32468 status=9614 reach, conf, sel_sys.peer, 1 event, event_reach,
> srcadr=, srcport=123, dstadr=, dstport=123, leap=00,
> stratum=1, precision=-18, rootdelay=0.000, rootdispersion=16.220,
> refid=DCFa, reach=377, unreach=0, hmode=3, pmode=4, hpoll=6, ppoll=6,
> flash=00 ok, keyid=0, ttl=0, offset=-69.648, delay=0.685,
> dispersion=2.849, jitter=61.865,
> reftime=c79d992c.40e63a5c  Wed, Feb 15 2006 13:12:28.253,
> org=c79d9943.421cac08  Wed, Feb 15 2006 13:12:51.258,
> rec=c79d9943.58e27e0e  Wed, Feb 15 2006 13:12:51.347,
> xmt=c79d9943.57713272  Wed, Feb 15 2006 13:12:51.341,
> filtdelay=  5.58    0.68    4.16   5.30    9.84    0.70    0.69  14.76,
> filtoffset=-86.17  -69.65  -51.84 -35.91  -20.53    1.51   18.26  29.64,
> filtdisp=    0.03    1.02    1.98   2.93    3.89    4.86    5.82    6.80
> The offset in this example is offset=-69.648 milliseconds.
> I'd like to know: what is the corresponding time of day when the 
> client/server exchange took place that lead to this offset measurement.
> The above output contains the timestamps "reftime", "org", "rec" and 
> "xmt". Which one is the correct one? Maybe it doesn't matter as long as 
> I use the same one?
> Cheers
> Daniel Kabs

More information about the questions mailing list