gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] Final revisions to the Time Service HOWTO


From: Eric S. Raymond
Subject: Re: [gpsd-dev] Final revisions to the Time Service HOWTO
Date: Thu, 21 Nov 2013 23:58:29 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

Miroslav Lichvar <address@hidden>:
> I mentioned it before, I don't think chronyd is easier to set up or
> configure.

But Gary does, and what I see in the chrony documentation backs him
up.  I notice in particular that the author has made some tasteful
changes in the config file syntax that de-obfuscate it significabtly.

> > gpsd can provide reference clock information to chronyd similarly to
> > the way it talks to ntpd.  The advantage to using chrony is that the
> > PPS time resolution is in nanoseconds.  This is 1,000 times more
> > precision than the microsecond time resolution provided to ntpd.  This
> > only matters if you has an RS-232 connected 1PPS refclock.  When
> > gpsd supports the new ntpd protocol this difference will disappear.
> 
> This is no longer true as the nanosecond SHM support was added to
> gpsd.

Removed.
 
> > Typical specs for oscillator packages are 20, 50, 100 ppm.  That includes
> > everything; initial accuracy, temperature, supply voltage, aging, etc.
> 
> Please note that the most commonly used clocksource in current systems
> is the time stamp counter (TSC) in the CPU.

That's an interesting datum but I'm not sure enough about the context to be 
sure I can use it. The TSC is *not* a crystal source, correct?  What does
its frequency variation look like?

> > Note that a low drift contributes to stability, not necessarily accuracy.
> 
> I'm not sure I understand this part. When a clock has 100ppm drift, it
> doesn't mean it's not stable, or not?

That sentence is Gary's and your response has confused me further.  Maybe
he'll have something enlightening to say.

> > So how do we calculate the drift?  The general idea is simple.  Measure the
> > time offset every N seconds, plot the graph, and fit a straight line.  The
> > slope of that line is the drift.  The units cancel out.  Parts-per-million 
> > is
> > a handy scale.
> 
> I think ntpd uses linear fit only on start without driftfile to get an
> initial frequency. In normal operation it works just with the latest
> measurement. The clock is adjusted by a PLL/FLL hybrid loop. The
> polling interval sets the PLL time constant, the ratio between them is
> fixed and may differ between systems (Linux uses 4 times shorter time
> constant than the reference design). If the clock is behind, the
> frequency will be increased a bit, if it's ahead the frequency is
> decreased. If the initial drift is wrong or the frequency changes
> rapidly, it may need a large number of updates until it settles down.

OK, this is too deep in the weeds and too ntpd-specific for the section
where it comes up. Linear fit with low-pass filtering is a good thing to
explain here because as interpolation techniques go it's simple and easy
to visualize - our target audience is likely to have good intuitions about it.
Not so for a "PLL/FLL hybrid loop".

So here's what I'm going to do:

    Both ntpd and chrony use this technique (ntpd also uses a more
    esoteric form of estimation called a "PLL/FLL hybrid loop").  Both NTP
    implementations automatically adjust the value of the polling interval
    to get the best results.  That turns into the N above.

This preserves the reader's (justified) sense of having gained some
understanding of drift compensation and saves us from having to
explain a lot of implementation-specific details about the differences
in what ntpd and chrony are doing.

> > //FIXME: Is it correct that chrony uses a linear fit with low-pass filter?
> 
> Yes, it uses up to 64 past measurements to make the fit. The measured
> time and frequency offsets are corrected separately. The number of
> points in the fit is selected by a statistical test.
> 
> > ntpd and chrony automatically adjust the value of the polling interval
> > to get the best results.  That turns into the N above.
> 
> ntpd controls the polling interval which sets the time constant.
> chronyd controls the polling interval and separately also the number
> of points in the linear fit.
> 
> With reference clocks, however, the polling interval in ntpd is fixed
> by default to 64 seconds (minpoll 6 maxpoll 6) and chronyd uses always
> constant polling interval, 16 seconds by default (poll 4).

Thanks for being excruciatingly cirrect about this. It's too much detail
for the HOWTO.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]