1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3 <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
5 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6 <title>Sntp User’s Manual</title>
8 <meta name="description" content="Sntp User’s Manual">
9 <meta name="keywords" content="Sntp User’s Manual">
10 <meta name="resource-type" content="document">
11 <meta name="distribution" content="global">
12 <meta name="Generator" content="makeinfo">
13 <link href="#Top" rel="start" title="Top">
14 <link href="dir.html#Top" rel="up" title="(dir)">
15 <style type="text/css">
17 a.summary-letter {text-decoration: none}
18 blockquote.indentedblock {margin-right: 0em}
19 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
20 blockquote.smallquotation {font-size: smaller}
21 div.display {margin-left: 3.2em}
22 div.example {margin-left: 3.2em}
23 div.lisp {margin-left: 3.2em}
24 div.smalldisplay {margin-left: 3.2em}
25 div.smallexample {margin-left: 3.2em}
26 div.smalllisp {margin-left: 3.2em}
27 kbd {font-style: oblique}
28 pre.display {font-family: inherit}
29 pre.format {font-family: inherit}
30 pre.menu-comment {font-family: serif}
31 pre.menu-preformatted {font-family: serif}
32 pre.smalldisplay {font-family: inherit; font-size: smaller}
33 pre.smallexample {font-size: smaller}
34 pre.smallformat {font-family: inherit; font-size: smaller}
35 pre.smalllisp {font-size: smaller}
36 span.nolinebreak {white-space: nowrap}
37 span.roman {font-family: initial; font-weight: normal}
38 span.sansserif {font-family: sans-serif; font-weight: normal}
39 ul.no-bullet {list-style: none}
47 <h1 class="settitle" align="center">Sntp User’s Manual</h1>
56 Next: <a href="#sntp-Description" accesskey="n" rel="next">sntp Description</a>, Previous: <a href="dir.html#Top" accesskey="p" rel="prev">(dir)</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> </p>
58 <a name="Simple-Network-Time-Protocol-User-Manual"></a>
59 <h1 class="top">Simple Network Time Protocol User Manual</h1>
61 <p>This document describes the use of the NTP Project’s <code>sntp</code> program,
62 that can be used to query a Network Time Protocol (NTP) server and
63 display the time offset of the system clock relative to the server
64 clock. Run as root, it can correct the system clock to this offset as
65 well. It can be run as an interactive command or from a cron job.
67 <p>This document applies to version 4.2.8p13 of <code>sntp</code>.
69 <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
72 <a name="SEC_Overview"></a>
73 <h2 class="shortcontents-heading">Short Table of Contents</h2>
75 <div class="shortcontents">
76 <ul class="no-bullet">
77 <li><a name="stoc-Description" href="#toc-Description">1 Description</a></li>
82 <table class="menu" border="0" cellspacing="0">
83 <tr><td align="left" valign="top">• <a href="#sntp-Description" accesskey="1">sntp Description</a>:</td><td> </td><td align="left" valign="top">Description
85 <tr><td align="left" valign="top">• <a href="#sntp-Invocation" accesskey="2">sntp Invocation</a>:</td><td> </td><td align="left" valign="top">Invoking sntp
87 <tr><td align="left" valign="top">• <a href="#Usage" accesskey="3">Usage</a>:</td><td> </td><td align="left" valign="top">Usage
92 <a name="sntp-Description"></a>
95 Next: <a href="#sntp-Invocation" accesskey="n" rel="next">sntp Invocation</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> </p>
97 <a name="Description"></a>
98 <h2 class="chapter">1 Description</h2>
100 <p>By default, <code>sntp</code> writes the local data and time (i.e., not UTC) to the
101 standard output in the format:
103 <div class="example">
104 <pre class="example">1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
108 YYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
109 (+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
111 the +4.567 +/- 0.089 secs indicates the time offset and
112 error bound of the system clock relative to the server clock.
114 <table class="menu" border="0" cellspacing="0">
115 <tr><td align="left" valign="top">• <a href="#sntp-Invocation" accesskey="1">sntp Invocation</a>:</td><td> </td><td align="left" valign="top">
117 <tr><td align="left" valign="top">• <a href="#Usage" accesskey="2">Usage</a>:</td><td> </td><td align="left" valign="top">
122 <a name="sntp-Invocation"></a>
125 Next: <a href="#Usage" accesskey="n" rel="next">Usage</a>, Previous: <a href="#sntp-Description" accesskey="p" rel="prev">sntp Description</a>, Up: <a href="#sntp-Description" accesskey="u" rel="up">sntp Description</a> </p>
127 <a name="Invoking-sntp"></a>
128 <h3 class="section">1.1 Invoking sntp</h3>
129 <a name="index-sntp"></a>
130 <a name="index-standard-Simple-Network-Time-Protocol-client-program"></a>
135 can be used as an SNTP client to query a NTP or SNTP server and either display
136 the time or set the local system’s time (given suitable privilege). It can be
137 run as an interactive command or from a
141 <p>NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
142 are defined and described by RFC 5905.
145 <p>The default is to write the estimated correct local date and time (i.e. not
146 UTC) to the standard output in a format like:
148 <p><code>'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'</code>
151 <code>'(+0800)'</code>
152 means that to get to UTC from the reported local time one must
153 add 8 hours and 0 minutes,
155 <code>'+4.567'</code>
156 indicates the local clock is 4.567 seconds behind the correct time
157 (so 4.567 seconds must be added to the local clock to get it to be correct).
158 Note that the number of decimals printed for this value will change
159 based on the reported precision of the server.
160 <code>'+/- 0.089'</code>
162 <em>synchronization</em> <em>distance</em>
163 (in seconds), which represents the maximum error due to all causes.
164 If the server does not report valid data needed to calculate the
165 synchronization distance, this will be reported as
166 <code>'+/- ?'</code>.
169 is different from the
171 both will be displayed.
177 of the host is reported
178 and the leap indicator is decoded and displayed.
180 <p>This section was generated by <strong>AutoGen</strong>,
181 using the <code>agtexi-cmd</code> template and the option descriptions for the <code>sntp</code> program.
182 This software is released under the NTP license, <http://ntp.org/license>.
184 <table class="menu" border="0" cellspacing="0">
185 <tr><td align="left" valign="top">• <a href="#sntp-usage" accesskey="1">sntp usage</a>:</td><td> </td><td align="left" valign="top">sntp help/usage (<samp>--help</samp>)
187 <tr><td align="left" valign="top">• <a href="#sntp-ipv4" accesskey="2">sntp ipv4</a>:</td><td> </td><td align="left" valign="top">ipv4 option (-4)
189 <tr><td align="left" valign="top">• <a href="#sntp-ipv6" accesskey="3">sntp ipv6</a>:</td><td> </td><td align="left" valign="top">ipv6 option (-6)
191 <tr><td align="left" valign="top">• <a href="#sntp-authentication" accesskey="4">sntp authentication</a>:</td><td> </td><td align="left" valign="top">authentication option (-a)
193 <tr><td align="left" valign="top">• <a href="#sntp-broadcast" accesskey="5">sntp broadcast</a>:</td><td> </td><td align="left" valign="top">broadcast option (-b)
195 <tr><td align="left" valign="top">• <a href="#sntp-concurrent" accesskey="6">sntp concurrent</a>:</td><td> </td><td align="left" valign="top">concurrent option (-c)
197 <tr><td align="left" valign="top">• <a href="#sntp-gap" accesskey="7">sntp gap</a>:</td><td> </td><td align="left" valign="top">gap option (-g)
199 <tr><td align="left" valign="top">• <a href="#sntp-kod" accesskey="8">sntp kod</a>:</td><td> </td><td align="left" valign="top">kod option (-K)
201 <tr><td align="left" valign="top">• <a href="#sntp-keyfile" accesskey="9">sntp keyfile</a>:</td><td> </td><td align="left" valign="top">keyfile option (-k)
203 <tr><td align="left" valign="top">• <a href="#sntp-logfile">sntp logfile</a>:</td><td> </td><td align="left" valign="top">logfile option (-l)
205 <tr><td align="left" valign="top">• <a href="#sntp-steplimit">sntp steplimit</a>:</td><td> </td><td align="left" valign="top">steplimit option (-M)
207 <tr><td align="left" valign="top">• <a href="#sntp-ntpversion">sntp ntpversion</a>:</td><td> </td><td align="left" valign="top">ntpversion option (-o)
209 <tr><td align="left" valign="top">• <a href="#sntp-usereservedport">sntp usereservedport</a>:</td><td> </td><td align="left" valign="top">usereservedport option (-r)
211 <tr><td align="left" valign="top">• <a href="#sntp-timeout">sntp timeout</a>:</td><td> </td><td align="left" valign="top">timeout option (-t)
213 <tr><td align="left" valign="top">• <a href="#sntp-wait">sntp wait</a>:</td><td> </td><td align="left" valign="top">wait option
215 <tr><td align="left" valign="top">• <a href="#sntp-config">sntp config</a>:</td><td> </td><td align="left" valign="top">presetting/configuring sntp
217 <tr><td align="left" valign="top">• <a href="#sntp-exit-status">sntp exit status</a>:</td><td> </td><td align="left" valign="top">exit status
219 <tr><td align="left" valign="top">• <a href="#sntp-Usage">sntp Usage</a>:</td><td> </td><td align="left" valign="top">Usage
221 <tr><td align="left" valign="top">• <a href="#sntp-Authors">sntp Authors</a>:</td><td> </td><td align="left" valign="top">Authors
226 <a name="sntp-usage"></a>
229 Next: <a href="#sntp-ipv4" accesskey="n" rel="next">sntp ipv4</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
231 <a name="sntp-help_002fusage-_0028_002d_002dhelp_0029"></a>
232 <h4 class="subsection">1.1.1 sntp help/usage (<samp>--help</samp>)</h4>
233 <a name="index-sntp-help"></a>
235 <p>This is the automatically generated usage text for sntp.
237 <p>The text printed is the same whether selected with the <code>help</code> option
238 (<samp>--help</samp>) or the <code>more-help</code> option (<samp>--more-help</samp>). <code>more-help</code> will print
239 the usage text by passing it through a pager program.
240 <code>more-help</code> is disabled on platforms without a working
241 <code>fork(2)</code> function. The <code>PAGER</code> environment variable is
242 used to select the program, defaulting to <samp>more</samp>. Both will exit
243 with a status code of 0.
245 <div class="example">
246 <pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p13
247 Usage: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \
248 [ hostname-or-IP ...]
249 Flg Arg Option-Name Description
250 -4 no ipv4 Force IPv4 DNS name resolution
251 - prohibits the option 'ipv6'
252 -6 no ipv6 Force IPv6 DNS name resolution
253 - prohibits the option 'ipv4'
254 -a Num authentication Enable authentication with the key auth-keynumber
255 -b Str broadcast Listen to the address specified for broadcast time sync
256 - may appear multiple times
257 -c Str concurrent Concurrently query all IPs returned for host-name
258 - may appear multiple times
259 -d no debug-level Increase debug verbosity level
260 - may appear multiple times
261 -D Num set-debug-level Set the debug verbosity level
262 - may appear multiple times
263 -g Num gap The gap (in milliseconds) between time requests
264 -K Fil kod KoD history filename
265 -k Fil keyfile Look in this file for the key specified with -a
266 -l Fil logfile Log to specified logfile
267 -M Num steplimit Adjustments less than steplimit msec will be slewed
268 - it must be in the range:
269 greater than or equal to 0
270 -o Num ntpversion Send int as our NTP protocol version
271 - it must be in the range:
273 -r no usereservedport Use the NTP Reserved Port (port 123)
274 -S no step OK to 'step' the time with settimeofday(2)
275 -s no slew OK to 'slew' the time with adjtime(2)
276 -t Num timeout The number of seconds to wait for responses
277 no wait Wait for pending replies (if not setting the time)
278 - disabled as '--no-wait'
280 opt version output version information and exit
281 -? no help display extended usage information and exit
282 -! no more-help extended usage information passed thru pager
283 -> opt save-opts save the option state to a config file
284 -< Str load-opts load options from a config file
285 - disabled as '--no-load-opts'
286 - may appear multiple times
288 Options are specified by doubled hyphens and their name or by a single
289 hyphen and the flag character.
292 The following option preset mechanisms are supported:
293 - reading file $HOME/.ntprc
294 - reading file ./.ntprc
295 - examining environment variables named SNTP_*
297 Please send bug reports to: <http://bugs.ntp.org, bugs@ntp.org>
301 <a name="sntp-ipv4"></a>
304 Next: <a href="#sntp-ipv6" accesskey="n" rel="next">sntp ipv6</a>, Previous: <a href="#sntp-usage" accesskey="p" rel="prev">sntp usage</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
306 <a name="ipv4-option-_0028_002d4_0029"></a>
307 <h4 class="subsection">1.1.2 ipv4 option (-4)</h4>
308 <a name="index-sntp_002dipv4"></a>
310 <p>This is the “force ipv4 dns name resolution” option.
312 <p>This option has some usage constraints. It:
314 <li> must not appear in combination with any of the following options:
318 <p>Force DNS resolution of the following host names on the command line
319 to the IPv4 namespace.
321 <a name="sntp-ipv6"></a>
324 Next: <a href="#sntp-authentication" accesskey="n" rel="next">sntp authentication</a>, Previous: <a href="#sntp-ipv4" accesskey="p" rel="prev">sntp ipv4</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
326 <a name="ipv6-option-_0028_002d6_0029"></a>
327 <h4 class="subsection">1.1.3 ipv6 option (-6)</h4>
328 <a name="index-sntp_002dipv6"></a>
330 <p>This is the “force ipv6 dns name resolution” option.
332 <p>This option has some usage constraints. It:
334 <li> must not appear in combination with any of the following options:
338 <p>Force DNS resolution of the following host names on the command line
339 to the IPv6 namespace.
341 <a name="sntp-authentication"></a>
344 Next: <a href="#sntp-broadcast" accesskey="n" rel="next">sntp broadcast</a>, Previous: <a href="#sntp-ipv6" accesskey="p" rel="prev">sntp ipv6</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
346 <a name="authentication-option-_0028_002da_0029"></a>
347 <h4 class="subsection">1.1.4 authentication option (-a)</h4>
348 <a name="index-sntp_002dauthentication"></a>
350 <p>This is the “enable authentication with the key <var>auth-keynumber</var>” option.
351 This option takes a number argument <samp>auth-keynumber</samp>.
352 Enable authentication using the key specified in this option’s
353 argument. The argument of this option is the <samp>keyid</samp>, a
354 number specified in the <samp>keyfile</samp> as this key’s identifier.
355 See the <samp>keyfile</samp> option (<samp>-k</samp>) for more details.
357 <a name="sntp-broadcast"></a>
360 Next: <a href="#sntp-concurrent" accesskey="n" rel="next">sntp concurrent</a>, Previous: <a href="#sntp-authentication" accesskey="p" rel="prev">sntp authentication</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
362 <a name="broadcast-option-_0028_002db_0029"></a>
363 <h4 class="subsection">1.1.5 broadcast option (-b)</h4>
364 <a name="index-sntp_002dbroadcast"></a>
366 <p>This is the “listen to the address specified for broadcast time sync” option.
367 This option takes a string argument <samp>broadcast-address</samp>.
369 <p>This option has some usage constraints. It:
371 <li> may appear an unlimited number of times.
374 <p>If specified <code>sntp</code> will listen to the specified address
375 for NTP broadcasts. The default maximum wait time
376 can (and probably should) be modified with <samp>-t</samp>.
378 <a name="sntp-concurrent"></a>
381 Next: <a href="#sntp-gap" accesskey="n" rel="next">sntp gap</a>, Previous: <a href="#sntp-broadcast" accesskey="p" rel="prev">sntp broadcast</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
383 <a name="concurrent-option-_0028_002dc_0029"></a>
384 <h4 class="subsection">1.1.6 concurrent option (-c)</h4>
385 <a name="index-sntp_002dconcurrent"></a>
387 <p>This is the “concurrently query all ips returned for host-name” option.
388 This option takes a string argument <samp>host-name</samp>.
390 <p>This option has some usage constraints. It:
392 <li> may appear an unlimited number of times.
395 <p>Requests from an NTP "client" to a "server" should never be sent
396 more rapidly than one every 2 seconds. By default, any IPs returned
397 as part of a DNS lookup are assumed to be for a single instance of
398 <code>ntpd</code>, and therefore <code>sntp</code> will send queries to these IPs
399 one after another, with a 2-second gap in between each query.
401 <p>The <samp>-c</samp> or <samp>--concurrent</samp> flag says that any IPs
402 returned for the DNS lookup of the supplied host-name are on
403 different machines, so we can send concurrent queries.
405 <a name="sntp-gap"></a>
408 Next: <a href="#sntp-kod" accesskey="n" rel="next">sntp kod</a>, Previous: <a href="#sntp-concurrent" accesskey="p" rel="prev">sntp concurrent</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
410 <a name="gap-option-_0028_002dg_0029"></a>
411 <h4 class="subsection">1.1.7 gap option (-g)</h4>
412 <a name="index-sntp_002dgap"></a>
414 <p>This is the “the gap (in milliseconds) between time requests” option.
415 This option takes a number argument <samp>milliseconds</samp>.
416 Since we’re only going to use the first valid response we get and
417 there is benefit to specifying a good number of servers to query,
418 separate the queries we send out by the specified number of
421 <a name="sntp-kod"></a>
424 Next: <a href="#sntp-keyfile" accesskey="n" rel="next">sntp keyfile</a>, Previous: <a href="#sntp-gap" accesskey="p" rel="prev">sntp gap</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
426 <a name="kod-option-_0028_002dK_0029"></a>
427 <h4 class="subsection">1.1.8 kod option (-K)</h4>
428 <a name="index-sntp_002dkod"></a>
430 <p>This is the “kod history filename” option.
431 This option takes a file argument <samp>file-name</samp>.
432 Specifies the filename to be used for the persistent history of KoD
433 responses received from servers. If the file does not exist, a
434 warning message will be displayed. The file will not be created.
436 <a name="sntp-keyfile"></a>
439 Next: <a href="#sntp-logfile" accesskey="n" rel="next">sntp logfile</a>, Previous: <a href="#sntp-kod" accesskey="p" rel="prev">sntp kod</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
441 <a name="keyfile-option-_0028_002dk_0029"></a>
442 <h4 class="subsection">1.1.9 keyfile option (-k)</h4>
443 <a name="index-sntp_002dkeyfile"></a>
445 <p>This is the “look in this file for the key specified with <samp>-a</samp>” option.
446 This option takes a file argument <samp>file-name</samp>.
447 This option specifies the keyfile.
448 <code>sntp</code> will search for the key specified with <samp>-a</samp>
449 <samp>keyno</samp> in this file. See <code>ntp.keys(5)</code> for more
452 <a name="sntp-logfile"></a>
455 Next: <a href="#sntp-steplimit" accesskey="n" rel="next">sntp steplimit</a>, Previous: <a href="#sntp-keyfile" accesskey="p" rel="prev">sntp keyfile</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
457 <a name="logfile-option-_0028_002dl_0029"></a>
458 <h4 class="subsection">1.1.10 logfile option (-l)</h4>
459 <a name="index-sntp_002dlogfile"></a>
461 <p>This is the “log to specified logfile” option.
462 This option takes a file argument <samp>file-name</samp>.
463 This option causes the client to write log messages to the specified
464 <samp>logfile</samp>.
466 <a name="sntp-steplimit"></a>
469 Next: <a href="#sntp-ntpversion" accesskey="n" rel="next">sntp ntpversion</a>, Previous: <a href="#sntp-logfile" accesskey="p" rel="prev">sntp logfile</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
471 <a name="steplimit-option-_0028_002dM_0029"></a>
472 <h4 class="subsection">1.1.11 steplimit option (-M)</h4>
473 <a name="index-sntp_002dsteplimit"></a>
475 <p>This is the “adjustments less than <var>steplimit</var> msec will be slewed” option.
476 This option takes a number argument.
477 If the time adjustment is less than <samp>steplimit</samp> milliseconds,
478 slew the amount using <code>adjtime(2)</code>. Otherwise, step the
479 correction using <code>settimeofday(2)</code>. The default value is 0,
480 which means all adjustments will be stepped. This is a feature, as
481 different situations demand different values.
483 <a name="sntp-ntpversion"></a>
486 Next: <a href="#sntp-usereservedport" accesskey="n" rel="next">sntp usereservedport</a>, Previous: <a href="#sntp-steplimit" accesskey="p" rel="prev">sntp steplimit</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
488 <a name="ntpversion-option-_0028_002do_0029"></a>
489 <h4 class="subsection">1.1.12 ntpversion option (-o)</h4>
490 <a name="index-sntp_002dntpversion"></a>
492 <p>This is the “send <var>int</var> as our ntp protocol version” option.
493 This option takes a number argument.
494 When sending requests to a remote server, tell them we are running
495 NTP protocol version <samp>ntpversion</samp> .
497 <a name="sntp-usereservedport"></a>
500 Next: <a href="#sntp-timeout" accesskey="n" rel="next">sntp timeout</a>, Previous: <a href="#sntp-ntpversion" accesskey="p" rel="prev">sntp ntpversion</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
502 <a name="usereservedport-option-_0028_002dr_0029"></a>
503 <h4 class="subsection">1.1.13 usereservedport option (-r)</h4>
504 <a name="index-sntp_002dusereservedport"></a>
506 <p>This is the “use the ntp reserved port (port 123)” option.
507 Use port 123, which is reserved for NTP, for our network
510 <a name="sntp-timeout"></a>
513 Next: <a href="#sntp-wait" accesskey="n" rel="next">sntp wait</a>, Previous: <a href="#sntp-usereservedport" accesskey="p" rel="prev">sntp usereservedport</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
515 <a name="timeout-option-_0028_002dt_0029"></a>
516 <h4 class="subsection">1.1.14 timeout option (-t)</h4>
517 <a name="index-sntp_002dtimeout"></a>
519 <p>This is the “the number of seconds to wait for responses” option.
520 This option takes a number argument <samp>seconds</samp>.
521 When waiting for a reply, <code>sntp</code> will wait the number
522 of seconds specified before giving up. The default should be
523 more than enough for a unicast response. If <code>sntp</code> is
524 only waiting for a broadcast response a longer timeout is
527 <a name="sntp-wait"></a>
530 Next: <a href="#sntp-config" accesskey="n" rel="next">sntp config</a>, Previous: <a href="#sntp-timeout" accesskey="p" rel="prev">sntp timeout</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
532 <a name="wait-option"></a>
533 <h4 class="subsection">1.1.15 wait option</h4>
534 <a name="index-sntp_002dwait"></a>
536 <p>This is the “wait for pending replies (if not setting the time)” option.
538 <p>This option has some usage constraints. It:
540 <li> can be disabled with –no-wait.
541 </li><li> It is enabled by default.
544 <p>If we are not setting the time, wait for all pending responses.
548 <a name="sntp-config"></a>
551 Next: <a href="#sntp-exit-status" accesskey="n" rel="next">sntp exit status</a>, Previous: <a href="#sntp-wait" accesskey="p" rel="prev">sntp wait</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
553 <a name="presetting_002fconfiguring-sntp"></a>
554 <h4 class="subsection">1.1.16 presetting/configuring sntp</h4>
556 <p>Any option that is not marked as <i>not presettable</i> may be preset by
557 loading values from configuration ("rc" or "ini") files, and values from environment variables named <code>SNTP</code> and <code>SNTP_<OPTION_NAME></code>. <code><OPTION_NAME></code> must be one of
558 the options listed above in upper case and segmented with underscores.
559 The <code>SNTP</code> variable will be tokenized and parsed like
560 the command line. The remaining variables are tested for existence and their
561 values are treated like option arguments.
564 <p><code>libopts</code> will search in 2 places for configuration files:
569 <p>The environment variables <code>HOME</code>, and <code>PWD</code>
570 are expanded and replaced when <samp>sntp</samp> runs.
571 For any of these that are plain files, they are simply processed.
572 For any that are directories, then a file named <samp>.ntprc</samp> is searched for
573 within that directory and processed.
575 <p>Configuration files may be in a wide variety of formats.
576 The basic format is an option name followed by a value (argument) on the
577 same line. Values may be separated from the option name with a colon,
578 equal sign or simply white space. Values may be continued across multiple
579 lines by escaping the newline with a backslash.
581 <p>Multiple programs may also share the same initialization file.
582 Common options are collected at the top, followed by program specific
583 segments. The segments are separated by lines like:
584 </p><div class="example">
585 <pre class="example">[SNTP]
588 </p><div class="example">
589 <pre class="example"><?program sntp>
591 <p>Do not mix these styles within one configuration file.
593 <p>Compound values and carefully constructed string values may also be
594 specified using XML syntax:
595 </p><div class="example">
596 <pre class="example"><option-name>
597 <sub-opt>...&lt;...&gt;...</sub-opt>
600 <p>yielding an <code>option-name.sub-opt</code> string value of
601 </p><div class="example">
602 <pre class="example">"...<...>..."
604 <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a
605 hierarchicly valued option. <code>AutoOpts</code> does provide a means for searching
606 the associated name/value pair list (see: optionFindValue).
608 <p>The command line options relating to configuration and/or usage help are:
610 <a name="version-_0028_002d_0029"></a>
611 <h4 class="subsubheading">version (-)</h4>
613 <p>Print the program version to standard out, optionally with licensing
614 information, then exit 0. The optional argument specifies how much licensing
615 detail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument.
616 Only the first letter of the argument is examined:
618 <dl compact="compact">
619 <dt>‘<samp>version</samp>’</dt>
620 <dd><p>Only print the version. This is the default.
622 <dt>‘<samp>copyright</samp>’</dt>
623 <dd><p>Name the copyright usage licensing terms.
625 <dt>‘<samp>verbose</samp>’</dt>
626 <dd><p>Print the full copyright usage licensing terms.
631 <a name="sntp-exit-status"></a>
634 Next: <a href="#sntp-Usage" accesskey="n" rel="next">sntp Usage</a>, Previous: <a href="#sntp-config" accesskey="p" rel="prev">sntp config</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
636 <a name="sntp-exit-status-1"></a>
637 <h4 class="subsection">1.1.17 sntp exit status</h4>
639 <p>One of the following exit values will be returned:
640 </p><dl compact="compact">
641 <dt>‘<samp>0 (EXIT_SUCCESS)</samp>’</dt>
642 <dd><p>Successful program execution.
644 <dt>‘<samp>1 (EXIT_FAILURE)</samp>’</dt>
645 <dd><p>The operation failed or the command syntax was not valid.
647 <dt>‘<samp>66 (EX_NOINPUT)</samp>’</dt>
648 <dd><p>A specified configuration file could not be loaded.
650 <dt>‘<samp>70 (EX_SOFTWARE)</samp>’</dt>
651 <dd><p>libopts had an internal operational error. Please report
652 it to autogen-users@lists.sourceforge.net. Thank you.
656 <a name="sntp-Usage"></a>
659 Next: <a href="#sntp-Authors" accesskey="n" rel="next">sntp Authors</a>, Previous: <a href="#sntp-exit-status" accesskey="p" rel="prev">sntp exit status</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
661 <a name="sntp-Usage-1"></a>
662 <h4 class="subsection">1.1.18 sntp Usage</h4>
664 <a name="sntp-Authors"></a>
667 Previous: <a href="#sntp-Usage" accesskey="p" rel="prev">sntp Usage</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p>
669 <a name="sntp-Authors-1"></a>
670 <h4 class="subsection">1.1.19 sntp Authors</h4>
676 Previous: <a href="#sntp-Invocation" accesskey="p" rel="prev">sntp Invocation</a>, Up: <a href="#sntp-Description" accesskey="u" rel="up">sntp Description</a> </p>
678 <a name="Usage-1"></a>
679 <h3 class="section">1.2 Usage</h3>
681 <p>The simplest use of this program is as an unprivileged command to
682 check the current time, offset, and error in the local clock.
685 <div class="example">
686 <pre class="example">sntp ntpserver.somewhere
689 <p>With suitable privilege, it can be run as a command or in a
690 <code>crom</code> job to reset the local clock from a reliable server, like
691 the <code>ntpdate</code> and <code>rdate</code> commands.
694 <div class="example">
695 <pre class="example">sntp -a ntpserver.somewhere