source: trunk/third/xntp/html/ntpdate.htm @ 16192

Revision 16192, 7.1 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r16191, which included commits to RCS files with non-trunk default branches.
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2<html>
3<head>
4<meta name="generator" content="HTML Tidy, see www.w3.org">
5<title>ntpdate - set the date and time via NTP</title>
6</head>
7<body>
8<h3><tt>ntpdate</tt> - set the date and time via NTP</h3>
9
10<img align="left" src="pic/rabbit.gif" alt="gif"><a href=
11"http://www.eecis.udel.edu/~mills/pictures.htm">from <i>Alice's
12Adventures in Wonderland</i>, Lewis Carroll</a>
13
14<p>I told you it was eyeball and wristwatch.<br clear="left">
15</p>
16
17<hr>
18<p>Disclaimer: The functionality of this program is now available
19in the <tt>ntpd</tt> program. See the <tt>-q</tt> command line
20option in the <a href="ntpd.htm"><tt>ntpd</tt> - Network Time
21Protocol (NTP) daemon</a> page. After a suitable period of
22mourning, the <tt>ntpdate</tt> program is to be retired from this
23distribution</p>
24
25<h4>Synopsis</h4>
26
27<tt>ntpdate [ -bBdoqsuv ] [ -a <i>key</i> ] [ -e <i>authdelay</i> ]
28[ -k <i>keyfile</i> ] [ -o <i>version</i> ] [ -p <i>samples</i> ] [
29-t <i>timeout</i> ] <i>server</i> [ ... ]</tt>
30
31<h4>Description</h4>
32
33<tt>ntpdate</tt> sets the local date and time by polling the
34Network Time Protocol (NTP) server(s) given as the <i>server</i>
35arguments to determine the correct time. It must be run as root on
36the local host. A number of samples are obtained from each of the
37servers specified and a subset of the NTP clock filter and
38selection algorithms are applied to select the best of these. Note
39that the accuracy and reliability of <tt>ntpdate</tt> depends on
40the number of servers, the number of polls each time it is run and
41the interval between runs.
42
43<p><tt>ntpdate</tt> can be run manually as necessary to set the
44host clock, or it can be run from the host startup script to set
45the clock at boot time. This is useful in some cases to set the
46clock initially before starting the NTP daemon <tt>ntpd</tt>. It is
47also possible to run <tt>ntpdate</tt> from a <tt>cron</tt> script.
48However, it is important to note that <tt>ntpdate</tt> with
49contrived <tt>cron</tt> scripts is no substitute for the NTP
50daemon, which uses sophisticated algorithms to maximize accuracy
51and reliability while minimizing resource use. Finally, since <tt>
52ntpdate</tt> does not discipline the host clock frequency as does
53<tt>ntpd</tt>, the accuracy using <tt>ntpdate</tt> is limited.</p>
54
55<p>Time adjustments are made by <tt>ntpdate</tt> in one of two
56ways. If <tt>ntpdate</tt> determines the clock is in error more
57than 0.5 second it will simply step the time by calling the system
58<tt>settimeofday()</tt> routine. If the error is less than 0.5
59seconds, it will slew the time by calling the system <tt>
60adjtime()</tt> routine. The latter technique is less disruptive and
61more accurate when the error is small, and works quite well when
62<tt>ntpdate</tt> is run by <tt>cron</tt> every hour or two.</p>
63
64<p><tt>ntpdate</tt> will decline to set the date if an NTP server
65daemon (e.g., <tt>ntpd</tt>) is running on the same host. When
66running <tt>ntpdate</tt> on a regular basis from <tt>cron</tt> as
67an alternative to running a daemon, doing so once every hour or two
68will result in precise enough timekeeping to avoid stepping the
69clock.</p>
70
71<p>If NetInfo support is compiled into <tt>ntpdate</tt>, then the
72<tt>server</tt> argument is optional if <tt>ntpdate</tt> can find a
73time server in the NetInfo configuration for <tt>ntpd</tt>.</p>
74
75<h4>Command Line Options</h4>
76
77<dl>
78<dt><tt>-a <i>key</i></tt></dt>
79
80<dd>Enable the authentication function and specify the key
81identifier to be used for authentication as the argument <i>
82key</i><tt>ntpdate</tt>. The keys and key identifiers must match in
83both the client and server key files. The default is to disable the
84authentication function.</dd>
85
86<dt><tt>-B</tt></dt>
87
88<dd>Force the time to always be slewed using the adjtime() system
89call, even if the measured offset is greater than +-128 ms. The
90default is to step the time using settimeofday() if the offset is
91greater than +-128 ms. Note that, if the offset is much greater
92than +-128 ms in this case, that it can take a long time (hours) to
93slew the clock to the correct value. During this time. the host
94should not be used to synchronize clients.</dd>
95
96<dt><tt>-b</tt></dt>
97
98<dd>Force the time to be stepped using the settimeofday() system
99call, rather than slewed (default) using the adjtime() system call.
100This option should be used when called from a startup file at boot
101time.</dd>
102
103<dt><tt>-d</tt></dt>
104
105<dd>Enable the debugging mode, in which <tt>ntpdate</tt> will go
106through all the steps, but not adjust the local clock. Information
107useful for general debugging will also be printed.</dd>
108
109<dt><tt>-e <i>authdelay</i></tt></dt>
110
111<dd>Specify the processing delay to perform an authentication
112function as the value <i>authdelay</i>, in seconds and fraction
113(see <tt>ntpd</tt> for details). This number is usually small
114enough to be negligible for most purposes, though specifying a
115value may improve timekeeping on very slow CPU's.</dd>
116
117<dt><tt>-k <i>keyfile</i></tt></dt>
118
119<dd>Specify the path for the authentication key file as the string
120<i>keyfile</i>. The default is <tt>/etc/ntp.keys</tt>. This file
121should be in the format described in <tt>ntpd</tt>.</dd>
122
123<dt><tt>-o <i>version</i></tt></dt>
124
125<dd>Specify the NTP version for outgoint packets as the integer <i>
126version</i>, which can be 1 or 2. The default is 3. This allows
127<tt>ntpdate</tt> to be used with older NTP versions.</dd>
128
129<dt><tt>-p <i>samples</i></tt></dt>
130
131<dd>Specify the number of samples to be acquired from each server
132as the integer <i>samples</i>, with values from 1 to 8 inclusive.
133The default is 4.</dd>
134
135<dt><i><tt>-q</tt></i></dt>
136
137<dd>Query only - don't set the clock.</dd>
138
139<dt><tt>-s</tt></dt>
140
141<dd>Divert logging output from the standard output (default) to the
142system <tt>syslog</tt> facility. This is designed primarily for
143convenience of <tt>cron</tt> scripts.</dd>
144
145<dt><tt>-t <i>timeout</i></tt></dt>
146
147<dd>Specify the maximum time waiting for a server response as the
148value <i>timeout</i>, in seconds and fraction. The value is is
149rounded to a multiple of 0.2 seconds. The default is 1 second, a
150value suitable for polling across a LAN.</dd>
151
152<dt><tt>-u</tt></dt>
153
154<dd>Direct <tt>ntpdate</tt> to use an unprivileged port or outgoing
155packets. This is most useful when behind a firewall that blocks
156incoming traffic to privileged ports, and you want to synchronise
157with hosts beyond the firewall. Note that the <tt>-d</tt> option
158always uses unprivileged ports.</dd>
159
160<dt><tt>-<i>v</i></tt></dt>
161
162<dd>Be verbose. This option will cause <tt>ntpdate</tt>'s version
163identification string to be logged.</dd>
164</dl>
165
166<h4>Files</h4>
167
168<tt>/etc/ntp.keys</tt> - encryption keys used by <tt>ntpdate</tt>.
169
170<h4>Bugs</h4>
171
172The slew adjustment is actually 50% larger than the measured
173offset, since this (it is argued) will tend to keep a badly
174drifting clock more accurate. This is probably not a good idea and
175may cause a troubling hunt for some values of the kernel variables
176<tt>tick</tt> and <tt>tickadj</tt>.&nbsp;
177
178<hr>
179<a href="index.htm"><img align="left" src="pic/home.gif" alt=
180"gif"></a>
181
182<address><a href="mailto:mills@udel.edu">David L. Mills
183&lt;mills@udel.edu&gt;</a></address>
184</body>
185</html>
186
Note: See TracBrowser for help on using the repository browser.