9 .Nd set the date and time via NTP
23 The functionality of this program is now available
33 After a suitable period of
36 utility is to be retired from this
41 utility sets the local date and time by polling the
42 Network Time Protocol (NTP) server(s) given as the
44 arguments to determine the correct time.
45 It must be run as root on
47 A number of samples are obtained from each of the
48 servers specified and a subset of the NTP clock filter and
49 selection algorithms are applied to select the best of these.
51 that the accuracy and reliability of
54 the number of servers, the number of polls each time it is run and
55 the interval between runs.
57 The following options are available:
58 .Bl -tag -width indent
60 Force DNS resolution of following host names on the command line to the
63 Force DNS resolution of following host names on the command line to the
66 Enable the authentication function and specify the key
67 identifier to be used for authentication as the argument
69 The keys and key identifiers must match
70 in both the client and server key files.
71 The default is to disable
72 the authentication function.
74 Force the time to always be slewed using the
77 call, even if the measured offset is greater than +-128 ms.
79 default is to step the time using
82 greater than +-128 ms.
83 Note that, if the offset is much greater
84 than +-128 ms in this case, it can take a long time (hours) to
85 slew the clock to the correct value.
86 During this time, the host
87 should not be used to synchronize clients.
89 Force the time to be stepped using the
92 call, rather than slewed (default) using the
95 This option should be used when called from a startup file at boot
98 Enable the debugging mode, in which
101 through all the steps, but not adjust the local clock.
103 useful for general debugging will also be printed.
104 .It Fl e Ar authdelay
105 Specify the processing delay to perform an authentication
106 function as the value
108 in seconds and fraction
112 This number is usually small
113 enough to be negligible for most purposes, though specifying a
114 value may improve timekeeping on very slow CPU's.
116 Specify the path for the authentication key file as the string
121 should be in the format described in
124 Specify the NTP version for outgoing packets as the integer
130 to be used with older NTP versions.
132 Specify the number of samples to be acquired from each server
135 with values from 1 to 8 inclusive.
138 Query only - do not set the clock.
140 Divert logging output from the standard output (default) to the
144 This is designed primarily for
149 Specify the maximum time waiting for a server response as the
152 in seconds and fraction.
154 rounded to a multiple of 0.2 seconds.
155 The default is 1 second, a
156 value suitable for polling across a LAN.
160 to use an unprivileged port for outgoing
162 This is most useful when behind a firewall that blocks
163 incoming traffic to privileged ports, and you want to synchronise
164 with hosts beyond the firewall.
168 always uses unprivileged ports.
171 This option will cause
174 identification string to be logged.
179 utility can be run manually as necessary to set the
180 host clock, or it can be run from the host startup script to set
181 the clock at boot time.
182 This is useful in some cases to set the
183 clock initially before starting the NTP daemon
191 However, it is important to note that
196 scripts is no substitute for the NTP
197 daemon, which uses sophisticated algorithms to maximize accuracy
198 and reliability while minimizing resource use.
201 does not discipline the host clock frequency as
209 Time adjustments are made by
215 determines the clock is in error more
216 than 0.5 second it will simply step the time by calling the system
219 If the error is less than 0.5
220 seconds, it will slew the time by calling the system
223 The latter technique is less disruptive
224 and more accurate when the error is small, and works quite well
234 utility will decline to set the date if an NTP server
237 is running on the same host.
241 on a regular basis from
244 an alternative to running a daemon, doing so once every hour or two
245 will result in precise enough timekeeping to avoid stepping the
248 Note that in contexts where a host name is expected, a
250 qualifier preceding the host name forces DNS resolution to the
251 IPv4 namespace, while a
253 qualifier forces DNS resolution to the IPv6 namespace.
255 If NetInfo support is compiled into
259 argument is optional if
262 time server in the NetInfo configuration for
265 .Bl -tag -width /etc/ntp.keys -compact
267 contains the encryption keys used by
273 The slew adjustment is actually 50% larger than the measured
274 offset, since this (it is argued) will tend to keep a badly
275 drifting clock more accurate.
276 This is probably not a good idea and
277 may cause a troubling hunt for some values of the kernel variables
278 .Va kern.clockrate.tick
280 .Va kern.clockrate.tickadj .