Home | History | Annotate | Line # | Download | only in sntp
sntp.html revision 1.1.1.4
      1 <html lang="en">
      2 <head>
      3 <title>Sntp User's Manual</title>
      4 <meta http-equiv="Content-Type" content="text/html">
      5 <meta name="description" content="Sntp User's Manual">
      6 <meta name="generator" content="makeinfo 4.7">
      7 <link title="Top" rel="top" href="#Top">
      8 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
      9 <meta http-equiv="Content-Style-Type" content="text/css">
     10 <style type="text/css"><!--
     11   pre.display { font-family:inherit }
     12   pre.format  { font-family:inherit }
     13   pre.smalldisplay { font-family:inherit; font-size:smaller }
     14   pre.smallformat  { font-family:inherit; font-size:smaller }
     15   pre.smallexample { font-size:smaller }
     16   pre.smalllisp    { font-size:smaller }
     17   span.sc { font-variant:small-caps }
     18   span.roman { font-family: serif; font-weight: normal; } 
     19 --></style>
     20 </head>
     21 <body>
     22 <h1 class="settitle">Sntp User's Manual</h1>
     23 <div class="node">
     24 <p><hr>
     25 <a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-Description">sntp Description</a>,
     26 Previous:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
     27 Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
     28 <br>
     29 </div>
     30 
     31 <h2 class="unnumbered">Simple Network Time Protocol User Manual</h2>
     32 
     33 <p>This document describes the use of the NTP Project's <code>sntp</code> program,
     34 that can be used to query a Network Time Protocol (NTP) server and
     35 display the time offset of the system clock relative to the server
     36 clock.  Run as root, it can correct the system clock to this offset as
     37 well.  It can be run as an interactive command or from a cron job.
     38 
     39   <p>This document applies to version 4.2.8 of <code>sntp</code>.
     40 
     41   <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
     42 IETF specification.
     43 
     44   <div class="shortcontents">
     45 <h2>Short Contents</h2>
     46 <ul>
     47 <a href="#Top">Simple Network Time Protocol User Manual</a>
     48 </ul>
     49 </div>
     50 
     51 <ul class="menu">
     52 <li><a accesskey="1" href="#sntp-Description">sntp Description</a>:             Description
     53 <li><a accesskey="2" href="#sntp-Invocation">sntp Invocation</a>: 		Invoking sntp
     54 <li><a accesskey="3" href="#Usage">Usage</a>:                        Usage
     55 </ul>
     56 
     57 <div class="node">
     58 <p><hr>
     59 <a name="sntp-Description"></a>
     60 <br>
     61 </div>
     62 
     63 <!-- node-name,  next,  previous,  up -->
     64 <h3 class="section">Description</h3>
     65 
     66 <p>By default, <code>sntp</code> writes the local data and time (i.e., not UTC) to the
     67 standard output in the format:
     68 
     69 <pre class="example">     1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
     70 </pre>
     71   <p>where
     72 YYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
     73 (+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
     74 and
     75 the +4.567 +/- 0.089 secs indicates the time offset and
     76 error bound of the system clock relative to the server clock.
     77 
     78 <div class="node">
     79 <p><hr>
     80 <a name="sntp-Invocation"></a>
     81 <br>
     82 </div>
     83 
     84 <h3 class="section">Invoking sntp</h3>
     85 
     86 <p><a name="index-sntp-1"></a><a name="index-standard-Simple-Network-Time-Protocol-client-program-2"></a>
     87 
     88   <p><code>sntp</code>
     89 can be used as an SNTP client to query a NTP or SNTP server and either display
     90 the time or set the local system's time (given suitable privilege).  It can be
     91 run as an interactive command or from a
     92 <code>cron</code>
     93 job.
     94 
     95   <p>NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
     96 are defined and described by RFC 5905.
     97 
     98   <p>The default is to write the estimated correct local date and time (i.e. not
     99 UTC) to the standard output in a format like:
    100 
    101   <p><code>'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'</code>
    102 
    103   <p>where the
    104 <code>'(+0800)'</code>
    105 means that to get to UTC from the reported local time one must
    106 add 8 hours and 0 minutes,
    107 the
    108 <code>'+4.567'</code>
    109 indicates the local clock is 4.567 seconds behind the correct time
    110 (so 4.567 seconds must be added to the local clock to get it to be correct). 
    111 Note that the number of decimals printed for this value will change
    112 based on the reported precision of the server. 
    113 <code>'+/- 0.089'</code>
    114 is the reported
    115 <em>synchronization</em> <em>distance</em>
    116 (in seconds), which represents the maximum error due to all causes. 
    117 If the server does not report valid data needed to calculate the
    118 synchronization distance, this will be reported as
    119 <code>'+/- ?'</code>. 
    120 If the
    121 <em>host</em>
    122 is different from the
    123 <em>IP</em>,
    124 both will be displayed. 
    125 Otherwise, only the
    126 <em>IP</em>
    127 is displayed. 
    128 Finally, the
    129 <em>stratum</em>
    130 of the host is reported.
    131 
    132   <p>This section was generated by <strong>AutoGen</strong>,
    133 using the <code>agtexi-cmd</code> template and the option descriptions for the <code>sntp</code> program. 
    134 This software is released under the NTP license, &lt;http://ntp.org/license>;.
    135 
    136 <ul class="menu">
    137 <li><a accesskey="1" href="#sntp-usage">sntp usage</a>:                   sntp help/usage (<span class="option">--help</span>)
    138 <li><a accesskey="2" href="#sntp-ipv4">sntp ipv4</a>:                    ipv4 option (-4)
    139 <li><a accesskey="3" href="#sntp-ipv6">sntp ipv6</a>:                    ipv6 option (-6)
    140 <li><a accesskey="4" href="#sntp-authentication">sntp authentication</a>:          authentication option (-a)
    141 <li><a accesskey="5" href="#sntp-broadcast">sntp broadcast</a>:               broadcast option (-b)
    142 <li><a accesskey="6" href="#sntp-concurrent">sntp concurrent</a>:              concurrent option (-c)
    143 <li><a accesskey="7" href="#sntp-gap">sntp gap</a>:                     gap option (-g)
    144 <li><a accesskey="8" href="#sntp-kod">sntp kod</a>:                     kod option (-K)
    145 <li><a accesskey="9" href="#sntp-keyfile">sntp keyfile</a>:                 keyfile option (-k)
    146 <li><a href="#sntp-logfile">sntp logfile</a>:                 logfile option (-l)
    147 <li><a href="#sntp-steplimit">sntp steplimit</a>:               steplimit option (-M)
    148 <li><a href="#sntp-ntpversion">sntp ntpversion</a>:              ntpversion option (-o)
    149 <li><a href="#sntp-usereservedport">sntp usereservedport</a>:         usereservedport option (-r)
    150 <li><a href="#sntp-timeout">sntp timeout</a>:                 timeout option (-t)
    151 <li><a href="#sntp-wait">sntp wait</a>:                    wait option
    152 <li><a href="#sntp-config">sntp config</a>:                  presetting/configuring sntp
    153 <li><a href="#sntp-exit-status">sntp exit status</a>:             exit status
    154 <li><a href="#sntp-Usage">sntp Usage</a>:                   Usage
    155 <li><a href="#sntp-Authors">sntp Authors</a>:                 Authors
    156 </ul>
    157 
    158 <div class="node">
    159 <p><hr>
    160 <a name="sntp-usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-ipv4">sntp ipv4</a>,
    161 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    162 <br>
    163 </div>
    164 
    165 <h4 class="subsection">sntp help/usage (<span class="option">--help</span>)</h4>
    166 
    167 <p><a name="index-sntp-help-3"></a>
    168 This is the automatically generated usage text for sntp.
    169 
    170   <p>The text printed is the same whether selected with the <code>help</code> option
    171 (<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>).  <code>more-help</code> will print
    172 the usage text by passing it through a pager program. 
    173 <code>more-help</code> is disabled on platforms without a working
    174 <code>fork(2)</code> function.  The <code>PAGER</code> environment variable is
    175 used to select the program, defaulting to <span class="file">more</span>.  Both will exit
    176 with a status code of 0.
    177 
    178 <pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8
    179 Usage:  sntp [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
    180                 [ hostname-or-IP ...]
    181   Flg Arg Option-Name    Description
    182    -4 no  ipv4           Force IPv4 DNS name resolution
    183                                 - prohibits the option 'ipv6'
    184    -6 no  ipv6           Force IPv6 DNS name resolution
    185                                 - prohibits the option 'ipv4'
    186    -a Num authentication Enable authentication with the key auth-keynumber
    187    -b Str broadcast      Listen to the address specified for broadcast time sync
    188                                 - may appear multiple times
    189    -c Str concurrent     Concurrently query all IPs returned for host-name
    190                                 - may appear multiple times
    191    -d no  debug-level    Increase debug verbosity level
    192                                 - may appear multiple times
    193    -D Num set-debug-level Set the debug verbosity level
    194                                 - may appear multiple times
    195    -g Num gap            The gap (in milliseconds) between time requests
    196    -K Fil kod            KoD history filename
    197    -k Fil keyfile        Look in this file for the key specified with -a
    198    -l Fil logfile        Log to specified logfile
    199    -M Num steplimit      Adjustments less than steplimit msec will be slewed
    200                                 - it must be in the range:
    201                                   greater than or equal to 0
    202    -o Num ntpversion     Send int as our NTP protocol version
    203                                 - it must be in the range:
    204                                   0 to 7
    205    -r no  usereservedport Use the NTP Reserved Port (port 123)
    206    -S no  step           OK to 'step' the time with settimeofday(2)
    207    -s no  slew           OK to 'slew' the time with adjtime(2)
    208    -t Num timeout        The number of seconds to wait for responses
    209       no  wait           Wait for pending replies (if not setting the time)
    210                                 - disabled as '--no-wait'
    211                                 - enabled by default
    212       opt version        output version information and exit
    213    -? no  help           display extended usage information and exit
    214    -! no  more-help      extended usage information passed thru pager
    215    -&gt; opt save-opts      save the option state to a config file
    216    -&lt; Str load-opts      load options from a config file
    217                                 - disabled as '--no-load-opts'
    218                                 - may appear multiple times
    219 
    220 Options are specified by doubled hyphens and their name or by a single
    221 hyphen and the flag character.
    222 
    223 
    224 The following option preset mechanisms are supported:
    225  - reading file $HOME/.ntprc
    226  - reading file ./.ntprc
    227  - examining environment variables named SNTP_*
    228 
    229 Please send bug reports to:  &lt;http://bugs.ntp.org, bugs (a] ntp.org&gt;
    230 </pre>
    231   <div class="node">
    232 <p><hr>
    233 <a name="sntp-ipv4"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-ipv6">sntp ipv6</a>,
    234 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-usage">sntp usage</a>,
    235 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    236 <br>
    237 </div>
    238 
    239 <h4 class="subsection">ipv4 option (-4)</h4>
    240 
    241 <p><a name="index-sntp_002dipv4-4"></a>
    242 This is the &ldquo;force ipv4 dns name resolution&rdquo; option.
    243 
    244 <p class="noindent">This option has some usage constraints.  It:
    245      <ul>
    246 <li>must not appear in combination with any of the following options:
    247 ipv6. 
    248 </ul>
    249 
    250   <p>Force DNS resolution of the following host names on the command line
    251 to the IPv4 namespace. 
    252 <div class="node">
    253 <p><hr>
    254 <a name="sntp-ipv6"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-authentication">sntp authentication</a>,
    255 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-ipv4">sntp ipv4</a>,
    256 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    257 <br>
    258 </div>
    259 
    260 <h4 class="subsection">ipv6 option (-6)</h4>
    261 
    262 <p><a name="index-sntp_002dipv6-5"></a>
    263 This is the &ldquo;force ipv6 dns name resolution&rdquo; option.
    264 
    265 <p class="noindent">This option has some usage constraints.  It:
    266      <ul>
    267 <li>must not appear in combination with any of the following options:
    268 ipv4. 
    269 </ul>
    270 
    271   <p>Force DNS resolution of the following host names on the command line
    272 to the IPv6 namespace. 
    273 <div class="node">
    274 <p><hr>
    275 <a name="sntp-authentication"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-broadcast">sntp broadcast</a>,
    276 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-ipv6">sntp ipv6</a>,
    277 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    278 <br>
    279 </div>
    280 
    281 <h4 class="subsection">authentication option (-a)</h4>
    282 
    283 <p><a name="index-sntp_002dauthentication-6"></a>
    284 This is the &ldquo;enable authentication with the key <var>auth-keynumber</var>&rdquo; option. 
    285 This option takes a number argument <span class="file">auth-keynumber</span>. 
    286 Enable authentication using the key specified in this option's
    287 argument.  The argument of this option is the <span class="option">keyid</span>, a
    288 number specified in the <span class="option">keyfile</span> as this key's identifier. 
    289 See the <span class="option">keyfile</span> option (<span class="option">-k</span>) for more details. 
    290 <div class="node">
    291 <p><hr>
    292 <a name="sntp-broadcast"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-concurrent">sntp concurrent</a>,
    293 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-authentication">sntp authentication</a>,
    294 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    295 <br>
    296 </div>
    297 
    298 <h4 class="subsection">broadcast option (-b)</h4>
    299 
    300 <p><a name="index-sntp_002dbroadcast-7"></a>
    301 This is the &ldquo;listen to the address specified for broadcast time sync&rdquo; option. 
    302 This option takes a string argument <span class="file">broadcast-address</span>.
    303 
    304 <p class="noindent">This option has some usage constraints.  It:
    305      <ul>
    306 <li>may appear an unlimited number of times. 
    307 </ul>
    308 
    309   <p>If specified <code>sntp</code> will listen to the specified address
    310 for NTP broadcasts.  The default maximum wait time
    311 can (and probably should) be modified with <span class="option">-t</span>. 
    312 <div class="node">
    313 <p><hr>
    314 <a name="sntp-concurrent"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-gap">sntp gap</a>,
    315 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-broadcast">sntp broadcast</a>,
    316 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    317 <br>
    318 </div>
    319 
    320 <h4 class="subsection">concurrent option (-c)</h4>
    321 
    322 <p><a name="index-sntp_002dconcurrent-8"></a>
    323 This is the &ldquo;concurrently query all ips returned for host-name&rdquo; option. 
    324 This option takes a string argument <span class="file">host-name</span>.
    325 
    326 <p class="noindent">This option has some usage constraints.  It:
    327      <ul>
    328 <li>may appear an unlimited number of times. 
    329 </ul>
    330 
    331   <p>Requests from an NTP "client" to a "server" should never be sent
    332 more rapidly than one every 2 seconds.  By default, any IPs returned
    333 as part of a DNS lookup are assumed to be for a single instance of
    334 <code>ntpd</code>, and therefore <code>sntp</code> will send queries to these IPs
    335 one after another, with a 2-second gap in between each query.
    336 
    337   <p>The <span class="option">-c</span> or <span class="option">--concurrent</span> flag says that any IPs
    338 returned for the DNS lookup of the supplied host-name are on
    339 different machines, so we can send concurrent queries. 
    340 <div class="node">
    341 <p><hr>
    342 <a name="sntp-gap"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-kod">sntp kod</a>,
    343 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-concurrent">sntp concurrent</a>,
    344 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    345 <br>
    346 </div>
    347 
    348 <h4 class="subsection">gap option (-g)</h4>
    349 
    350 <p><a name="index-sntp_002dgap-9"></a>
    351 This is the &ldquo;the gap (in milliseconds) between time requests&rdquo; option. 
    352 This option takes a number argument <span class="file">milliseconds</span>. 
    353 Since we're only going to use the first valid response we get and
    354 there is benefit to specifying a good number of servers to query,
    355 separate the queries we send out by the specified number of
    356 milliseconds. 
    357 <div class="node">
    358 <p><hr>
    359 <a name="sntp-kod"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-keyfile">sntp keyfile</a>,
    360 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-gap">sntp gap</a>,
    361 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    362 <br>
    363 </div>
    364 
    365 <h4 class="subsection">kod option (-K)</h4>
    366 
    367 <p><a name="index-sntp_002dkod-10"></a>
    368 This is the &ldquo;kod history filename&rdquo; option. 
    369 This option takes a file argument <span class="file">file-name</span>. 
    370 Specifies the filename to be used for the persistent history of KoD
    371 responses received from servers.  If the file does not exist, a
    372 warning message will be displayed.  The file will not be created. 
    373 <div class="node">
    374 <p><hr>
    375 <a name="sntp-keyfile"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-logfile">sntp logfile</a>,
    376 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-kod">sntp kod</a>,
    377 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    378 <br>
    379 </div>
    380 
    381 <h4 class="subsection">keyfile option (-k)</h4>
    382 
    383 <p><a name="index-sntp_002dkeyfile-11"></a>
    384 This is the &ldquo;look in this file for the key specified with <span class="option">-a</span>&rdquo; option. 
    385 This option takes a file argument <span class="file">file-name</span>. 
    386 This option specifies the keyfile. 
    387 <code>sntp</code> will search for the key specified with <span class="option">-a</span>
    388 <span class="file">keyno</span> in this file.  See <span class="command">ntp.keys(5)</span> for more
    389 information. 
    390 <div class="node">
    391 <p><hr>
    392 <a name="sntp-logfile"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-steplimit">sntp steplimit</a>,
    393 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-keyfile">sntp keyfile</a>,
    394 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    395 <br>
    396 </div>
    397 
    398 <h4 class="subsection">logfile option (-l)</h4>
    399 
    400 <p><a name="index-sntp_002dlogfile-12"></a>
    401 This is the &ldquo;log to specified logfile&rdquo; option. 
    402 This option takes a file argument <span class="file">file-name</span>. 
    403 This option causes the client to write log messages to the specified
    404 <span class="file">logfile</span>. 
    405 <div class="node">
    406 <p><hr>
    407 <a name="sntp-steplimit"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-ntpversion">sntp ntpversion</a>,
    408 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-logfile">sntp logfile</a>,
    409 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    410 <br>
    411 </div>
    412 
    413 <h4 class="subsection">steplimit option (-M)</h4>
    414 
    415 <p><a name="index-sntp_002dsteplimit-13"></a>
    416 This is the &ldquo;adjustments less than <var>steplimit</var> msec will be slewed&rdquo; option. 
    417 This option takes a number argument. 
    418 If the time adjustment is less than <span class="file">steplimit</span> milliseconds,
    419 slew the amount using <span class="command">adjtime(2)</span>.  Otherwise, step the
    420 correction using <span class="command">settimeofday(2)</span>. 
    421 <div class="node">
    422 <p><hr>
    423 <a name="sntp-ntpversion"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-usereservedport">sntp usereservedport</a>,
    424 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-steplimit">sntp steplimit</a>,
    425 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    426 <br>
    427 </div>
    428 
    429 <h4 class="subsection">ntpversion option (-o)</h4>
    430 
    431 <p><a name="index-sntp_002dntpversion-14"></a>
    432 This is the &ldquo;send <var>int</var> as our ntp protocol version&rdquo; option. 
    433 This option takes a number argument. 
    434 When sending requests to a remote server, tell them we are running
    435 NTP protocol version <span class="file">ntpversion</span> . 
    436 <div class="node">
    437 <p><hr>
    438 <a name="sntp-usereservedport"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-timeout">sntp timeout</a>,
    439 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-ntpversion">sntp ntpversion</a>,
    440 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    441 <br>
    442 </div>
    443 
    444 <h4 class="subsection">usereservedport option (-r)</h4>
    445 
    446 <p><a name="index-sntp_002dusereservedport-15"></a>
    447 This is the &ldquo;use the ntp reserved port (port 123)&rdquo; option. 
    448 Use port 123, which is reserved for NTP, for our network
    449 communications. 
    450 <div class="node">
    451 <p><hr>
    452 <a name="sntp-timeout"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-wait">sntp wait</a>,
    453 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-usereservedport">sntp usereservedport</a>,
    454 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    455 <br>
    456 </div>
    457 
    458 <h4 class="subsection">timeout option (-t)</h4>
    459 
    460 <p><a name="index-sntp_002dtimeout-16"></a>
    461 This is the &ldquo;the number of seconds to wait for responses&rdquo; option. 
    462 This option takes a number argument <span class="file">seconds</span>. 
    463 When waiting for a reply, <code>sntp</code> will wait the number
    464 of seconds specified before giving up.  The default should be
    465 more than enough for a unicast response.  If <code>sntp</code> is
    466 only waiting for a broadcast response a longer timeout is
    467 likely needed. 
    468 <div class="node">
    469 <p><hr>
    470 <a name="sntp-wait"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-config">sntp config</a>,
    471 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-timeout">sntp timeout</a>,
    472 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    473 <br>
    474 </div>
    475 
    476 <h4 class="subsection">wait option</h4>
    477 
    478 <p><a name="index-sntp_002dwait-17"></a>
    479 This is the &ldquo;wait for pending replies (if not setting the time)&rdquo; option.
    480 
    481 <p class="noindent">This option has some usage constraints.  It:
    482      <ul>
    483 <li>can be disabled with &ndash;no-wait. 
    484 <li>It is enabled by default. 
    485 </ul>
    486 
    487   <p>If we are not setting the time, wait for all pending responses.
    488 
    489 <div class="node">
    490 <p><hr>
    491 <a name="sntp-config"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-exit-status">sntp exit status</a>,
    492 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-wait">sntp wait</a>,
    493 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    494 <br>
    495 </div>
    496 
    497 <h4 class="subsection">presetting/configuring sntp</h4>
    498 
    499 <p>Any option that is not marked as <i>not presettable</i> may be preset by
    500 loading values from configuration ("rc" or "ini") files, and values from environment variables named <code>SNTP</code> and <code>SNTP_&lt;OPTION_NAME&gt;</code>.  <code>&lt;OPTION_NAME&gt;</code> must be one of
    501 the options listed above in upper case and segmented with underscores. 
    502 The <code>SNTP</code> variable will be tokenized and parsed like
    503 the command line.  The remaining variables are tested for existence and their
    504 values are treated like option arguments.
    505 
    506 <p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
    507      <ul>
    508 <li>$HOME
    509 <li>$PWD
    510 </ul>
    511   The environment variables <code>HOME</code>, and <code>PWD</code>
    512 are expanded and replaced when <span class="file">sntp</span> runs. 
    513 For any of these that are plain files, they are simply processed. 
    514 For any that are directories, then a file named <span class="file">.ntprc</span> is searched for
    515 within that directory and processed.
    516 
    517   <p>Configuration files may be in a wide variety of formats. 
    518 The basic format is an option name followed by a value (argument) on the
    519 same line.  Values may be separated from the option name with a colon,
    520 equal sign or simply white space.  Values may be continued across multiple
    521 lines by escaping the newline with a backslash.
    522 
    523   <p>Multiple programs may also share the same initialization file. 
    524 Common options are collected at the top, followed by program specific
    525 segments.  The segments are separated by lines like:
    526 <pre class="example">    [SNTP]
    527 </pre>
    528   <p class="noindent">or by
    529 <pre class="example">    &lt;?program sntp&gt;
    530 </pre>
    531   <p class="noindent">Do not mix these styles within one configuration file.
    532 
    533   <p>Compound values and carefully constructed string values may also be
    534 specified using XML syntax:
    535 <pre class="example">    &lt;option-name&gt;
    536        &lt;sub-opt&gt;...&amp;lt;...&amp;gt;...&lt;/sub-opt&gt;
    537     &lt;/option-name&gt;
    538 </pre>
    539   <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
    540 <pre class="example">    "...&lt;...&gt;..."
    541 </pre>
    542   <p><code>AutoOpts</code> does not track suboptions.  You simply note that it is a
    543 hierarchicly valued option.  <code>AutoOpts</code> does provide a means for searching
    544 the associated name/value pair list (see: optionFindValue).
    545 
    546   <p>The command line options relating to configuration and/or usage help are:
    547 
    548 <h5 class="subsubheading">version (-)</h5>
    549 
    550 <p>Print the program version to standard out, optionally with licensing
    551 information, then exit 0.  The optional argument specifies how much licensing
    552 detail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument. 
    553 Only the first letter of the argument is examined:
    554 
    555      <dl>
    556 <dt><span class="samp">version</span><dd>Only print the version.  This is the default. 
    557 <br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 
    558 <br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 
    559 </dl>
    560 
    561 <div class="node">
    562 <p><hr>
    563 <a name="sntp-exit-status"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-Usage">sntp Usage</a>,
    564 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-config">sntp config</a>,
    565 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    566 <br>
    567 </div>
    568 
    569 <h4 class="subsection">sntp exit status</h4>
    570 
    571 <p>One of the following exit values will be returned:
    572      <dl>
    573 <dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 
    574 <br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 
    575 <br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 
    576 <br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error.  Please report
    577 it to autogen-users (a] lists.sourceforge.net.  Thank you. 
    578 </dl>
    579   <div class="node">
    580 <p><hr>
    581 <a name="sntp-Usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-Authors">sntp Authors</a>,
    582 Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-exit-status">sntp exit status</a>,
    583 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    584 <br>
    585 </div>
    586 
    587 <h4 class="subsection">sntp Usage</h4>
    588 
    589 <div class="node">
    590 <p><hr>
    591 <a name="sntp-Authors"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-Usage">sntp Usage</a>,
    592 Up:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
    593 <br>
    594 </div>
    595 
    596 <h4 class="subsection">sntp Authors</h4>
    597 
    598 <div class="node">
    599 <p><hr>
    600 <a name="Usage"></a>
    601 <br>
    602 </div>
    603 
    604 <!-- node-name,  next,  previous,  up -->
    605 <h3 class="section">Usage</h3>
    606 
    607 <p>The simplest use of this program is as an unprivileged command to
    608 check the current time, offset, and error in the local clock. 
    609 For example:
    610 
    611 <pre class="example">    sntp ntpserver.somewhere
    612 </pre>
    613   <p>With suitable privilege, it can be run as a command or in a
    614 <code>crom</code> job to reset the local clock from a reliable server, like
    615 the <code>ntpdate</code> and <code>rdate</code> commands. 
    616 For example:
    617 
    618 <pre class="example">    sntp -a ntpserver.somewhere
    619 </pre>
    620   </body></html>
    621 
    622