[ntp:questions] ntpd vs ntpd -qg

Steve Kostecke kostecke at ntp.org
Thu Oct 13 14:48:56 UTC 2011

On 2011-10-13, Harlan Stenn <stenn at ntp.org> wrote:

> Riccardo wrote:
>> What do you think about usage of 'ntpd -qd' command or 'ntpd' daemon
>> for synchronization for client ? What differences ?
> 'ntpd -q' runs for a short time and exits. It sets the time once, and
> then goes away. It does nothing for long-term synchronization.

I believe that the OP is asking about 'ntpd -qg' vs ntpd in daemon mode.

ntpd -gq sets the clock and exits in a manner similar to ntpdate and
sntp; it can be used to block the system boot process until the clock is
initially "set". Unlike ntpdate and sntp this invocation of ntpd uses
the time sources defined in ntp.conf and collects enough information to
sanely "set" the clock (at the cost of a slightly longer period of
operation). The kernel clock can, and will, drift between invocations od
'ntpd -qg'.

ntpd in daemon mode continuously "steers" the kernel clock towards the
apparent correct time as determined from polling a set of time sources.

> There used to be a very small reason to consider setting the time
> before running ntpd, but I forgot what that reason was.

ntpd will exit when it sees an offset greater than the "panic threshold"
(1024 secs).

So, in the past, it was customary to use something else (usually
ntpdate) to "pre-set" the clock and get it close enough for ntpd's

Current versions of ntpd include a '-g' flag which allows one time step
exceeding the "panic threshold". This feature allows ntpd to set the
clock at start up without help from another piece of software.

Steve Kostecke <kostecke at ntp.org>
NTP Public Services Project - http://support.ntp.org/

More information about the questions mailing list