1ntpdate(8)                  System Manager's Manual                 ntpdate(8)
2
3
4

NAME

6       ntpdate - set the date and time via NTP
7
8
9       Disclaimer: This program has known bugs and deficiencies and nobody has
10       volunteered to fix them in a long time. The good news is the  function‐
11       ality originally intended for this program is available in the ntpd and
12       sntp programs. See the Deprecating ntpdate topic  in  the  NTP  Support
13       wiki  for  a thorough discussion and analysis of the issues. See the -q
14       command line option in the ntpd - Network Time  Protocol  (NTP)  daemon
15       page and/or the sntp - Simple Network Time Protocol (SNTP) Client page.
16       After a suitable period  of  mourning,  the  ntpdate  program  will  be
17       retired from this distribution.
18
19

SYNOPSIS

21       ntpdate  [ -46bBdqsuv ] [ -a key ] [ -e authdelay ] [ -k keyfile ] [ -o
22       version ] [ -p samples ] [ -t timeout ] server [ ... ]
23
24

DESCRIPTION

26       ntpdate sets the local date and time by polling the Network Time Proto‐
27       col (NTP) server(s) given as the server arguments to determine the cor‐
28       rect time. It must be run as root on the local host. A number  of  sam‐
29       ples  are  obtained  from each of the servers specified and a subset of
30       the NTP clock filter and selection algorithms are applied to select the
31       best  of  these.  Note  that  the  accuracy  and reliability of ntpdate
32       depends on the number of servers, the number of polls each time  it  is
33       run and the interval between runs.
34
35       ntpdate  can  be run manually as necessary to set the host clock, or it
36       can be run from the host startup script to set the clock at boot  time.
37       This is useful in some cases to set the clock initially before starting
38       the NTP daemon ntpd. It is also possible to run  ntpdate  from  a  cron
39       script.  However,  it  is important to note that ntpdate with contrived
40       cron scripts is no substitute for the NTP daemon, which uses  sophisti‐
41       cated  algorithms to maximize accuracy and reliability while minimizing
42       resource use. Finally, since ntpdate does not discipline the host clock
43       frequency as does ntpd, the accuracy using ntpdate is limited.
44
45       Time  adjustments  are  made  by ntpdate in one of two ways. If ntpdate
46       determines the clock is in error more than 0.5 second  it  will  simply
47       step  the  time  by  calling  the system settimeofday() routine. If the
48       error is less than 0.5 seconds, it will slew the time  by  calling  the
49       system  adjtime()  routine. The latter technique is less disruptive and
50       more accurate when the error is small, and works quite well  when  ntp‐
51       date is run by cron every hour or two.
52
53       ntpdate will, if the -u flag was not specified, decline to set the date
54       if an NTP server daemon (e.g., ntpd) is running on the same host.  When
55       running  ntpdate on a regular basis from cron as an alternative to run‐
56       ning a daemon, doing so once every hour or two will result  in  precise
57       enough timekeeping to avoid stepping the clock.
58
59       Note  that  in  contexts  where a host name is expected, a -4 qualifier
60       preceding the host name forces DNS resolution to  the  IPv4  namespace,
61       while a -6 qualifier forces DNS resolution to the IPv6 namespace.
62
63       If  NetInfo  support is compiled into ntpdate, then the server argument
64       is optional if ntpdate can find a time server in the NetInfo configura‐
65       tion for ntpd.
66
67

COMMAND LINE OPTIONS

69       -4      Force  DNS  resolution  of  following host names on the command
70               line to the IPv4 namespace.
71
72       -6      Force DNS resolution of following host  names  on  the  command
73               line to the IPv6 namespace.
74
75       -a key  Enable  the authentication function and specify the key identi‐
76               fier to be used for authentication as  the  argument  key.  The
77               keys  and  key  identifiers  must  match in both the client and
78               server key files. The default is to disable the  authentication
79               function.
80
81       -B      Force  the  time to always be slewed using the adjtime() system
82               call, even if the measured offset is greater than +-500 ms. The
83               default  is to step the time using settimeofday() if the offset
84               is greater than +-500 ms. Note that,  if  the  offset  is  much
85               greater  than  +-500  ms  in this case, that it can take a long
86               time (hours) to slew the clock to  the  correct  value.  During
87               this time. the host should not be used to synchronize clients.
88
89       -b      Force  the  time  to be stepped using the settimeofday() system
90               call, rather than slewed (default) using the  adjtime()  system
91               call.  This  option  should  be used when called from a startup
92               file at boot time.
93
94       -d      Enable the debugging mode, in which ntpdate will go through all
95               the steps, but not adjust the local clock and using an unprivi‐
96               leged port. Information useful for general debugging will  also
97               be printed.
98
99       -e authdelay
100               Specify the processing delay to perform an authentication func‐
101               tion as the value authdelay, in seconds and fraction (see  ntpd
102               for  details). This number is usually small enough to be negli‐
103               gible for most purposes, though specifying a value may  improve
104               timekeeping on very slow CPU's.
105
106       -k keyfile
107               Specify  the path for the authentication key file as the string
108               keyfile. The default is /etc/ntp.keys. This file should  be  in
109               the format described in ntpd.
110
111       -o version
112               Specify  the  NTP  version  for outgoing packets as the integer
113               version, which can be 1, 2, 3 or 4.  The  default  is  4.  This
114               allows ntpdate to be used with older NTP versions.
115
116       -p samples
117               Specify  the  number of samples to be acquired from each server
118               as the integer samples, with values from 1 to 8 inclusive.  The
119               default is 4.
120
121       -q      Query only - don't set the clock.
122
123       -s      Divert logging output from the standard output (default) to the
124               system syslog facility. This is designed primarily  for  conve‐
125               nience of cron scripts.
126
127       -t timeout
128               Specify  the  maximum time waiting for a server response as the
129               value timeout, in seconds and fraction. The value is is rounded
130               to a multiple of 0.2 seconds. The default is 2 seconds, a value
131               suitable for polling across a LAN.
132
133       -u      Direct ntpdate to use an unprivileged port for  outgoing  pack‐
134               ets.  This  is  most  useful when behind a firewall that blocks
135               incoming traffic to privileged ports, and you want to  synchro‐
136               nize  with  hosts  beyond the firewall. Note that the -d option
137               always uses unprivileged ports.
138
139       -v      Be verbose. This option will cause ntpdate's version  identifi‐
140               cation string to be logged.
141
142

DIAGNOSTICS

144       ntpdate's  exit  status  is  zero  if it finds a server and updates the
145       clock, and nonzero otherwise.
146
147

FILES

149       /etc/ntp.keys - encryption keys used by ntpdate.
150
151

BUGS

153       The slew adjustment is actually 50% larger than  the  measured  offset,
154       since this (it is argued) will tend to keep a badly drifting clock more
155       accurate. This is probably not a good idea and may  cause  a  troubling
156       hunt for some values of the kernel variables tick and tickadj.
157

SEE ALSO

159       ntpd(8)
160
161       The official HTML documentation.
162
163       This file was automatically generated from HTML source.
164
165
166
167
168                                                                    ntpdate(8)
Impressum