\" $NetBSD: ntpdate.8,v 1.1 2010/08/28 15:42:46 kardel Exp $
\" Converted from HTML to mandoc by ntp-html2mdoc.pl
\"
Dd January 28, 2010
Dt NTPDATE 8
Os
Sh NAME
Nm ntpdate
Nd set the date and time via NTP
Sh SYNOPSIS
Nm
Op Fl bBdoqsuv
Op Fl a Ar key
Op Fl e Ar authdelay
Op Fl k Ar keyfile
Op Fl o Ar version
Op Fl p Ar samples
Op Fl t Ar timeout
Op Ar server ...
Sh DESCRIPTION
Nm
sets the local date and time by polling the Network Time
Protocol (NTP) server(s) given as the
Ar server
arguments to determine
the correct time. It must be run as root on the local host. A number of
samples are obtained from each of the servers specified and a subset of
the NTP clock filter and selection algorithms are applied to select the
best of these. Note that the accuracy and reliability of
Nm
depends on the number of servers, the number of polls each time it is run
and the interval between runs.
Pp
Nm
can be run manually as necessary to set the host clock,
or it can be run from the host startup script to set the clock at boot
time. This is useful in some cases to set the clock initially before starting
the NTP daemon
Pa ntpd .
It is also possible to run
Nm
from a
Pa cron
script. However, it is important to note that
Nm
with contrived
Pa cron
scripts is no substitute for the NTP daemon,
which uses sophisticated algorithms to maximize accuracy and reliability
while minimizing resource use. Finally, since
Nm
does not
discipline the host clock frequency as does
Pa ntpd ,
the accuracy
using
Nm
is limited.
Pp
Time adjustments are made by
Nm
in one of two ways. If
Nm
determines the clock is in error more than 0.5 second
it will simply step the time by calling the system
Xr settimeofday 2
routine. If the error is less than 0.5 seconds, it will slew the time by
calling the system
Xr adjtime 2
routine. The latter technique is
less disruptive and more accurate when the error is small, and works quite
well when
Nm
is run by
Pa cron
every hour or two.
Pp
Nm
will decline to set the date if an NTP server daemon
(e.g.,
Pa ntpd
) is running on the same host. When running
Nm
on a regular basis from
Pa cron
as an alternative to running a daemon,
doing so once every hour or two will result in precise enough timekeeping
to avoid stepping the clock.
Pp
If NetInfo support is compiled into
Nm ,
then the
Pa server
argument is optional if
Nm
can find a time
server in the NetInfo configuration for
Pa ntpd