[ntp:questions] ntpd -q and driftfile

unruh unruh at wormhole.physics.ubc.ca
Tue Mar 22 17:22:20 UTC 2011

On 2011-03-22, David J Taylor <david-taylor at blueyonder.co.uk.invalid> wrote:
>> He can do that if he wants to. That was why the -q option was designed
>> into ntpd-- one time setting of the clock time. However it cannot create
>> a drift file. If he wants a drift file then as you say, he must run it
>> continuously.
> You could look at it that way, Bill, if all he needs is a one-off setting. 
> However, Prashant says he wants to run it periodically, which doesn't 
> really make sense.  Rather than a periodic run, he should leave ntpd 
> running continuously, which is what ntpd is designed for.

ntpd -q is a replacemtn for ntpdate, which was typically run from cron,
and he is doing, and it is an "acceptable" procedure if for example you
do not want a daemon running which could have (unknown to you) security
issues. It is also a bit unclear how to switch off the server role of
ntpd and he may not want others querying his machine. On the other had
it comes at a cost of far worse clock discipline and the probability of
the computer jumping backwards in time. 

> Prashant, the fact that the server capability is already built-in to ntpd 
> in no way detracts from using ntpd just as a client for your PC to keep 
> the time spot-on.  Just leave it running all the time as it uses very 
> little resources.  It will then compute the drift information after (IIRC) 
> one hours of running, and it will keep your PC clock correct by adjusting 
> the rate, rather than bang-bang adjustments of the time.

One hour? More like 10 hr. ntpd is really bad at recovering from
changes, and switchon is a big change. 
After 1 hr the drift is liable to be way off, as ntpd alters the drift
to bring the clock back into line.

> Cheers,
> David 

More information about the questions mailing list