1ntpdate(8) System Manager's Manual ntpdate(8)
2
3
4
6 ntpdate - set the date and time via NTP
7
8
9 Disclaimer: The functionality of this program is now available in the
10 ntpd program. See the -q command line option in the ntpd - Network Time
11 Protocol (NTP) daemon page. After a suitable period of mourning, the
12 ntpdate program is to be retired from this distribution
13
14
16 ntpdate [ -46bBdqsuv ] [ -a key ] [ -e authdelay ] [ -k keyfile ] [ -o
17 version ] [ -p samples ] [ -t timeout ] [ -U user_name ] server [ ... ]
18
19
21 ntpdate sets the local date and time by polling the Network Time Proto‐
22 col (NTP) server(s) given as the server arguments to determine the cor‐
23 rect time. It must be run as root on the local host. A number of sam‐
24 ples are obtained from each of the servers specified and a subset of
25 the NTP clock filter and selection algorithms are applied to select the
26 best of these. Note that the accuracy and reliability of ntpdate
27 depends on the number of servers, the number of polls each time it is
28 run and the interval between runs.
29
30 ntpdate can be run manually as necessary to set the host clock, or it
31 can be run from the host startup script to set the clock at boot time.
32 This is useful in some cases to set the clock initially before starting
33 the NTP daemon ntpd. It is also possible to run ntpdate from a cron
34 script. However, it is important to note that ntpdate with contrived
35 cron scripts is no substitute for the NTP daemon, which uses sophisti‐
36 cated algorithms to maximize accuracy and reliability while minimizing
37 resource use. Finally, since ntpdate does not discipline the host clock
38 frequency as does ntpd, the accuracy using ntpdate is limited.
39
40 Time adjustments are made by ntpdate in one of two ways. If ntpdate
41 determines the clock is in error more than 0.5 second it will simply
42 step the time by calling the system settimeofday() routine. If the
43 error is less than 0.5 seconds, it will slew the time by calling the
44 system adjtime() routine. The latter technique is less disruptive and
45 more accurate when the error is small, and works quite well when ntp‐
46 date is run by cron every hour or two.
47
48 ntpdate will decline to set the date if an NTP server daemon (e.g.,
49 ntpd) is running on the same host. When running ntpdate on a regular
50 basis from cron as an alternative to running a daemon, doing so once
51 every hour or two will result in precise enough timekeeping to avoid
52 stepping the clock.
53
54 Note that in contexts where a host name is expected, a -4 qualifier
55 preceding the host name forces DNS resolution to the IPv4 namespace,
56 while a -6 qualifier forces DNS resolution to the IPv6 namespace.
57
58 If NetInfo support is compiled into ntpdate, then the server argument
59 is optional if ntpdate can find a time server in the NetInfo configura‐
60 tion for ntpd.
61
62
64 -4 Force DNS resolution of following host names on the command
65 line to the IPv4 namespace.
66
67 -6 Force DNS resolution of following host names on the command
68 line to the IPv6 namespace.
69
70 -a key Enable the authentication function and specify the key identi‐
71 fier to be used for authentication as the argument key. The
72 keys and key identifiers must match in both the client and
73 server key files. The default is to disable the authentication
74 function.
75
76 -B Force the time to always be slewed using the adjtime() system
77 call, even if the measured offset is greater than +-500 ms. The
78 default is to step the time using settimeofday() if the offset
79 is greater than +-500 ms. Note that, if the offset is much
80 greater than +-500 ms in this case, that it can take a long
81 time (hours) to slew the clock to the correct value. During
82 this time. the host should not be used to synchronize clients.
83
84 -b Force the time to be stepped using the settimeofday() system
85 call, rather than slewed (default) using the adjtime() system
86 call. This option should be used when called from a startup
87 file at boot time.
88
89 -d Enable the debugging mode, in which ntpdate will go through all
90 the steps, but not adjust the local clock. Information useful
91 for general debugging will also be printed.
92
93 -e authdelay
94 Specify the processing delay to perform an authentication func‐
95 tion as the value authdelay, in seconds and fraction (see ntpd
96 for details). This number is usually small enough to be negli‐
97 gible for most purposes, though specifying a value may improve
98 timekeeping on very slow CPU's.
99
100 -k keyfile
101 Specify the path for the authentication key file as the string
102 keyfile. The default is /etc/ntp/keys. This file should be in
103 the format described in ntpd.
104
105 -o version
106 Specify the NTP version for outgoing packets as the integer
107 version, which can be 1 or 2. The default is 4. This allows
108 ntpdate to be used with older NTP versions.
109
110 -p samples
111 Specify the number of samples to be acquired from each server
112 as the integer samples, with values from 1 to 8 inclusive. The
113 default is 4.
114
115 -q Query only - don't set the clock.
116
117 -s Divert logging output from the standard output (default) to the
118 system syslog facility. This is designed primarily for conve‐
119 nience of cron scripts.
120
121 -t timeout
122 Specify the maximum time waiting for a server response as the
123 value timeout, in seconds and fraction. The value is is rounded
124 to a multiple of 0.2 seconds. The default is 1 second, a value
125 suitable for polling across a LAN.
126
127 -u Direct ntpdate to use an unprivileged port for outgoing pack‐
128 ets. This is most useful when behind a firewall that blocks
129 incoming traffic to privileged ports, and you want to synchro‐
130 nize with hosts beyond the firewall. Note that the -d option
131 always uses unprivileged ports.
132
133 -v Be verbose. This option will cause ntpdate's version identifi‐
134 cation string to be logged.
135
136 -U user_name
137 ntpdate process drops root privileges and changes user ID to
138 user_name and group ID to the primary group of server_user.
139
140
142 ntpdate's exit status is zero if it finds a server and updates the
143 clock, and nonzero otherwise.
144
145
147 /etc/ntp/keys - encryption keys used by ntpdate.
148
149
151 The slew adjustment is actually 50% larger than the measured offset,
152 since this (it is argued) will tend to keep a badly drifting clock more
153 accurate. This is probably not a good idea and may cause a troubling
154 hunt for some values of the kernel variables tick and tickadj.
155
157 ntpd(8)
158
159 The official HTML documentation.
160
161 This file was automatically generated from HTML source.
162
163
164
165
166 ntpdate(8)