[ntp:questions] offline machines' time synchronization

Chris Albertson albertson.chris at gmail.com
Thu May 24 20:14:28 UTC 2012

On Thu, May 24, 2012 at 11:53 AM, Dave Hart <hart at ntp.org> wrote:

> ntpd requires reference clocks provide time, not just frequency.  How
> do you discipline the Rb PPS to occur at the top of the UTC second (or
> a fixed offset from the top)?

That is that part where I said "It takes some effort"  There are
several ways, I really don't have a crical need for this but there are
worse hobbies.

In all cases you first have to adjust the Rb oscillator's frequency.
The Rb units all have an RS-232 port and yu can send commands to make
them go faster or slower.  Details vary.  You must compare the Rb
frequency to the GPS and send command until they match.  The Rb is
VERY stable and you can use a days long time constant in the control
loop.  Very easy to do in software.   Or you can even watch the beat
frequency on an 'scope and type the commands in via a terminal
program.  Lots of ways to set the frequency.

Next how to get the PPS to be at the top of the second.  Two methods

1) don't bother.  Linux PPS will log the time of both the GPS's PPS
and the Rb PPS.  Read the log file to determine the offset.  This give
offset with uSec precision.  To get better you need a hardware time
interval counter.  I happen to have a few of those and can read
sub-nanoseconds but this is gross overkill.  Microseconds are good
enough for NTP.

2) You can adjust the phase of the PPS by speeding up the Rb frequency
well above what it should be for some number of seconds and then
slowing it back to the "correct" speed.  This exercise will move the
phase.  Slowing it will work to move the phase in the other direction.

3) For gross adjustment of the phase a "big hammer" works.  Power
cycle the Rb unit and chances are the phase will change by some
totally random amount.   Repeat this process as required.  Yes this
sounds stupid but on average you can get "close" with not to many
cycles.   Then you apply ether of the two above methods.   (I call
this "spin the clock hands".  At you were to spin the hands on a real
clock like a roulette wheel they would land in the correct number one
in twelve times.)

One could use a micro controller to do the above. But if you are
running NTP you obviously already have a larger computer available.

Techniques like #3 work because no one cares about the Rb's output
while the GPS is running so you can power cycle it or run it at over
speed and do no harm.   But eventually you get "close" and then only
need to make tiny adjustments to the rate once every few days.  You
can monitor the phase by using #1 above.  RS-232 commands can
typically adjust the rate to within about 5E-12 or maybe 1E-11.
Thus when GPS fails you have a local clock that you now is "pretty
good"  better really than NTP needs and lieu good enough to keep a
cell tower "on frequency" for more than 48 hours.


Chris Albertson
Redondo Beach, California

More information about the questions mailing list