[ntp:questions] Re: Difference between Ntpdate and NTPDaemon

Brian Utterback brian.utterback at sun.removeme.com
Mon May 15 19:43:45 UTC 2006

Leandro Pfleger de Aguiar wrote:
> Sure
>     I can understand this.  But what the phrase "ntpdate does not discipline
> the host clock frequency as does ntpd" means, once both ntpd and ntpdate use
> adjtime()? I know ntpdate use this function when offset <128ms, so why i
> cannot to say that ntpdate discipline the host clock frequency ? Just
> because ntpdate synchronize and exits ?
> Tanks again !

Let me clarify. The ntpdate program determines the offset, sets the
clock to reduce the offset to zero and then exits. Thus is your
clock is a little fast, if you were to run ntpdate again later,
you would again have an offset.

On the other hand, ntpd is constantly determining the current offset
and also setting the clock to reduce the offset to zero. But in
addition, since it has the benefit of multiple samples, it can see
that the clock runs fast and by how much. Once it knows how fast the
clock is, it can determine how much ahead it will get each second,
and then pro-actively call adjtime to adjust the clock by this small
amount each second. Thus the offset never gets more than the offset
the clock gets in one second.

Over time, ntpd gets a more accurate idea of what this adjustment
is, so that the clock can be very accurate all the time.

All of this assumes that ntpd is in fact using the adjtime call
and not the ntp_adjtime call. The ntp_adjtime call does the
same thing, but gets the kernel in the act and instead of making
the correction once each second, the kernel applies the adjustment
itself, once each tick, thus providing for a very high accuracy all
the time.

The act of speeding the clock up or slowing it down is called adjusting
the clock frequency.

Rose are #FF0000, Violets are #0000FF. All my base are belong to you.
Brian Utterback - OP/N1 RPE, Sun Microsystems, Inc.
Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom

More information about the questions mailing list