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