[ntp:questions] no ntp synchronisation: 2s to 6s time shift !

Serge Bets serge.bets at NOSPAM.laposte.invalid
Wed Feb 20 16:02:53 UTC 2008

Hello Thierry,

 On Tuesday, February 19, 2008 at 16:43:10 +0100, Thierry MARTIN wrote:

> # rm /etc/adjtime;
> # ntpdate ntp.cines.fr;
> # hwclock --systohc;

This procedure sets the RTC once, but does not evaluate its drift. While
adjtimex --adjust needs to know the runtime drift rate of the RTC. So
this should be:

| # ntpdate -b ntp.cines.fr
| # hwclock --systohc
|	wait some hours (minimum 1 to 24 hours depending on hwclock
|	version) while the machine continues to run its usual tasks
| # ntpdate -b ntp.cines.fr
| # hwclock --systohc

This last command sets the RTC again *and* writes into /etc/adjtime
the needed drift correction factor in seconds per day. Now only can
adjtimex --adjust work correctly. Works, but is still not the best
method to set the kernel freq, if you don't mind me to repeat. And after
all that is finished, don't forget to set /etc/adjtime to a sane
power-off RTC drift rate (see my next article).

Note that the nude ntpdate without option does not set the system clock
immediatly nor correctly. For this procedure -b (force step) is
required. Or something better.

> Keeping a linux system with the correct time without any external
> synchronisation really seems hard...

That's very doable, but requires some amounts of efforts. ;-)
In comparision, setting up a DCF77 or GPS refclock for the ntpd daemon
is not so deadly complicated.

Cordialement, Serge.
Serge point Bets arobase laposte point net

More information about the questions mailing list