[ntp:questions] ntpd -gq VS ntpdate -B

RICCARDO castellani.riccardo at tiscali.it
Thu Apr 12 15:42:56 UTC 2007

On Apr 11, 4:39 pm, Tom Smith <s... at cag.zko.hp.com> wrote:
> "ntpdate -b" steps the time after doing a quick look at set of
> candidates you have specified on the command line. It is what
> is normally recommended for a boot sequence prior to starting ntpd.
> "ntpdate -B" slews the time, but is otherwise the same. Not
> usually recommended for a boot sequence because the initial
> time setting isn't complete when it exits.
> "ntpd -gq" uses all the convergence rules of the normal
> ntpd against a list of servers specified in a separate
> configuration file. After selecting a peer, it will either
> step OR slew the time, depending on the magnitude of
> the offset, and the time adjustment may or may not be
> complete when it exits. It is not equivalent to either
> "ntpdate -b" or "ntpdate -B".
> ntpdate takes a few milliseconds to run (dependent on
> network delays and timeouts) and sets the clock typically
> within a few milliseconds of "correct" with respect to
> the servers you have chosen to use. "ntpd -gq" takes a minimum
> of a few seconds to reach convergence and produces about the
> same practical level of accuracy. In steady state, ntpd,
> of course, is much more accurate and less disruptive than
> repeated use of ntpdate.
> -Tom
> castellani.ricca... at tiscali.it wrote:
> > I know ntpdate is deprecated but I'm interesting to know if they work
> > in the same way, is ntpdate behavior different in comparison to ntpd ?
> > ----Messaggio originale----
> > Da: s... at ntp.isc.org
> > Data: 11/04/2007 1.43
> > A: <questi... at lists.ntp.isc.org>
> > Ogg: Re: [ntp:questions] ntpd -gq VS ntpdate -B
> >>>> In article <1176216808.517213.274... at w1g2000hsg.googlegroups.com>,
> > "RICCARDO" <castellani.ricca... at tiscali.it> writes:
> > RICCARDO> If I use ntpd -gq in my client I should adjust time to
> > little
> > RICCARDO> steps using adjtime system call, but what's difference with
> > RICCARDO> "ntpdate -B" ?
> > ntpdate is being deprecated.
> > ntpd -gq will set the time and exit.  If the difference is less than
> > 128ms
> > the time will be slewed, if the difference is more the clock will be
> > stepped.
> > H
> > _______________________________________________
> > questions mailing list
> > questi... at lists.ntp.isc.org
> >https://lists.ntp.isc.org/mailman/listinfo/questions
> > Naviga e telefona senza limiti con Tiscali
> > Scopri le promozioni Tiscali adsl: navighi e telefoni senza canone Telecom
> >http://abbonati.tiscali.it/adsl/
> > _______________________________________________
> > questions mailing list
> > questi... at lists.ntp.isc.org
> >https://lists.ntp.isc.org/mailman/listinfo/questions

Thanks for your exhaustive explanation but I have also one doubt:
If for example I used in cron "ntpdate -c server1 server2" (without
taking accuracy but only convergence time) and local clock was
different from NTP server time for 60 seconds, ntpdate will step time
taking several hours ! How can it destructive ? Time will not adjust
in few seconds but in several hours, I think.
Ntpd -qg with this time difference has the same behavior. Do you agree
with me ?

See following reference of ntpdate manual:

If  ntpdate determines  the  clock  is in error more than 0.5 second
it will simply step the time by calling the system settimeofday()
routine.  If the error is less than 0.5 seconds, it will slew the time
by calling the system adjtime()  routine

More information about the questions mailing list