1290001Sglebius<html lang="en">
2290001Sglebius<head>
3290001Sglebius<title>Sntp User's Manual</title>
4290001Sglebius<meta http-equiv="Content-Type" content="text/html">
5290001Sglebius<meta name="description" content="Sntp User's Manual">
6290001Sglebius<meta name="generator" content="makeinfo 4.7">
7290001Sglebius<link title="Top" rel="top" href="#Top">
8290001Sglebius<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
9290001Sglebius<meta http-equiv="Content-Style-Type" content="text/css">
10290001Sglebius<style type="text/css"><!--
11290001Sglebius  pre.display { font-family:inherit }
12290001Sglebius  pre.format  { font-family:inherit }
13290001Sglebius  pre.smalldisplay { font-family:inherit; font-size:smaller }
14290001Sglebius  pre.smallformat  { font-family:inherit; font-size:smaller }
15290001Sglebius  pre.smallexample { font-size:smaller }
16290001Sglebius  pre.smalllisp    { font-size:smaller }
17290001Sglebius  span.sc { font-variant:small-caps }
18290001Sglebius  span.roman { font-family: serif; font-weight: normal; } 
19290001Sglebius--></style>
20290001Sglebius</head>
21290001Sglebius<body>
22290001Sglebius<h1 class="settitle">Sntp User's Manual</h1>
23290001Sglebius<div class="node">
24290001Sglebius<p><hr>
25290001Sglebius<a name="Top"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-Description">sntp Description</a>,
26290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#dir">(dir)</a>,
27290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
28290001Sglebius<br>
29290001Sglebius</div>
30290001Sglebius
31290001Sglebius<h2 class="unnumbered">Simple Network Time Protocol User Manual</h2>
32290001Sglebius
33290001Sglebius<p>This document describes the use of the NTP Project's <code>sntp</code> program,
34290001Sglebiusthat can be used to query a Network Time Protocol (NTP) server and
35290001Sglebiusdisplay the time offset of the system clock relative to the server
36290001Sglebiusclock.  Run as root, it can correct the system clock to this offset as
37290001Sglebiuswell.  It can be run as an interactive command or from a cron job.
38290001Sglebius
39310419Sdelphij  <p>This document applies to version 4.2.8p9 of <code>sntp</code>.
40290001Sglebius
41290001Sglebius  <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
42290001SglebiusIETF specification.
43290001Sglebius
44290001Sglebius  <div class="shortcontents">
45290001Sglebius<h2>Short Contents</h2>
46290001Sglebius<ul>
47290001Sglebius<a href="#Top">Simple Network Time Protocol User Manual</a>
48290001Sglebius</ul>
49290001Sglebius</div>
50290001Sglebius
51290001Sglebius<ul class="menu">
52290001Sglebius<li><a accesskey="1" href="#sntp-Description">sntp Description</a>:             Description
53290001Sglebius<li><a accesskey="2" href="#sntp-Invocation">sntp Invocation</a>: 		Invoking sntp
54290001Sglebius<li><a accesskey="3" href="#Usage">Usage</a>:                        Usage
55290001Sglebius</ul>
56290001Sglebius
57290001Sglebius<div class="node">
58290001Sglebius<p><hr>
59290001Sglebius<a name="sntp-Description"></a>
60290001Sglebius<br>
61290001Sglebius</div>
62290001Sglebius
63290001Sglebius<!-- node-name,  next,  previous,  up -->
64290001Sglebius<h3 class="section">Description</h3>
65290001Sglebius
66290001Sglebius<p>By default, <code>sntp</code> writes the local data and time (i.e., not UTC) to the
67290001Sglebiusstandard output in the format:
68290001Sglebius
69290001Sglebius<pre class="example">     1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs
70290001Sglebius</pre>
71290001Sglebius  <p>where
72290001SglebiusYYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time,
73290001Sglebius(+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC),
74290001Sglebiusand
75290001Sglebiusthe +4.567 +/- 0.089 secs indicates the time offset and
76290001Sglebiuserror bound of the system clock relative to the server clock.
77290001Sglebius
78290001Sglebius<div class="node">
79290001Sglebius<p><hr>
80290001Sglebius<a name="sntp-Invocation"></a>
81290001Sglebius<br>
82290001Sglebius</div>
83290001Sglebius
84290001Sglebius<h3 class="section">Invoking sntp</h3>
85290001Sglebius
86290001Sglebius<p><a name="index-sntp-1"></a><a name="index-standard-Simple-Network-Time-Protocol-client-program-2"></a>
87290001Sglebius
88290001Sglebius  <p><code>sntp</code>
89290001Sglebiuscan be used as an SNTP client to query a NTP or SNTP server and either display
90290001Sglebiusthe time or set the local system's time (given suitable privilege).  It can be
91290001Sglebiusrun as an interactive command or from a
92290001Sglebius<code>cron</code>
93290001Sglebiusjob.
94290001Sglebius
95290001Sglebius  <p>NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
96290001Sglebiusare defined and described by RFC 5905.
97290001Sglebius
98290001Sglebius  <p>The default is to write the estimated correct local date and time (i.e. not
99290001SglebiusUTC) to the standard output in a format like:
100290001Sglebius
101290001Sglebius  <p><code>'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'</code>
102290001Sglebius
103290001Sglebius  <p>where the
104290001Sglebius<code>'(+0800)'</code>
105290001Sglebiusmeans that to get to UTC from the reported local time one must
106290001Sglebiusadd 8 hours and 0 minutes,
107290001Sglebiusthe
108290001Sglebius<code>'+4.567'</code>
109290001Sglebiusindicates the local clock is 4.567 seconds behind the correct time
110290001Sglebius(so 4.567 seconds must be added to the local clock to get it to be correct). 
111290001SglebiusNote that the number of decimals printed for this value will change
112290001Sglebiusbased on the reported precision of the server. 
113290001Sglebius<code>'+/- 0.089'</code>
114290001Sglebiusis the reported
115290001Sglebius<em>synchronization</em> <em>distance</em>
116290001Sglebius(in seconds), which represents the maximum error due to all causes. 
117290001SglebiusIf the server does not report valid data needed to calculate the
118290001Sglebiussynchronization distance, this will be reported as
119290001Sglebius<code>'+/- ?'</code>. 
120290001SglebiusIf the
121290001Sglebius<em>host</em>
122290001Sglebiusis different from the
123290001Sglebius<em>IP</em>,
124290001Sglebiusboth will be displayed. 
125290001SglebiusOtherwise, only the
126290001Sglebius<em>IP</em>
127290001Sglebiusis displayed. 
128290001SglebiusFinally, the
129290001Sglebius<em>stratum</em>
130290001Sglebiusof the host is reported
131290001Sglebiusand the leap indicator is decoded and displayed.
132290001Sglebius
133290001Sglebius  <p>This section was generated by <strong>AutoGen</strong>,
134290001Sglebiususing the <code>agtexi-cmd</code> template and the option descriptions for the <code>sntp</code> program. 
135290001SglebiusThis software is released under the NTP license, &lt;http://ntp.org/license>;.
136290001Sglebius
137290001Sglebius<ul class="menu">
138290001Sglebius<li><a accesskey="1" href="#sntp-usage">sntp usage</a>:                   sntp help/usage (<span class="option">--help</span>)
139290001Sglebius<li><a accesskey="2" href="#sntp-ipv4">sntp ipv4</a>:                    ipv4 option (-4)
140290001Sglebius<li><a accesskey="3" href="#sntp-ipv6">sntp ipv6</a>:                    ipv6 option (-6)
141290001Sglebius<li><a accesskey="4" href="#sntp-authentication">sntp authentication</a>:          authentication option (-a)
142290001Sglebius<li><a accesskey="5" href="#sntp-broadcast">sntp broadcast</a>:               broadcast option (-b)
143290001Sglebius<li><a accesskey="6" href="#sntp-concurrent">sntp concurrent</a>:              concurrent option (-c)
144290001Sglebius<li><a accesskey="7" href="#sntp-gap">sntp gap</a>:                     gap option (-g)
145290001Sglebius<li><a accesskey="8" href="#sntp-kod">sntp kod</a>:                     kod option (-K)
146290001Sglebius<li><a accesskey="9" href="#sntp-keyfile">sntp keyfile</a>:                 keyfile option (-k)
147290001Sglebius<li><a href="#sntp-logfile">sntp logfile</a>:                 logfile option (-l)
148290001Sglebius<li><a href="#sntp-steplimit">sntp steplimit</a>:               steplimit option (-M)
149290001Sglebius<li><a href="#sntp-ntpversion">sntp ntpversion</a>:              ntpversion option (-o)
150290001Sglebius<li><a href="#sntp-usereservedport">sntp usereservedport</a>:         usereservedport option (-r)
151290001Sglebius<li><a href="#sntp-timeout">sntp timeout</a>:                 timeout option (-t)
152290001Sglebius<li><a href="#sntp-wait">sntp wait</a>:                    wait option
153290001Sglebius<li><a href="#sntp-config">sntp config</a>:                  presetting/configuring sntp
154290001Sglebius<li><a href="#sntp-exit-status">sntp exit status</a>:             exit status
155290001Sglebius<li><a href="#sntp-Usage">sntp Usage</a>:                   Usage
156290001Sglebius<li><a href="#sntp-Authors">sntp Authors</a>:                 Authors
157290001Sglebius</ul>
158290001Sglebius
159290001Sglebius<div class="node">
160290001Sglebius<p><hr>
161290001Sglebius<a name="sntp-usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-ipv4">sntp ipv4</a>,
162290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
163290001Sglebius<br>
164290001Sglebius</div>
165290001Sglebius
166290001Sglebius<h4 class="subsection">sntp help/usage (<span class="option">--help</span>)</h4>
167290001Sglebius
168290001Sglebius<p><a name="index-sntp-help-3"></a>
169290001SglebiusThis is the automatically generated usage text for sntp.
170290001Sglebius
171290001Sglebius  <p>The text printed is the same whether selected with the <code>help</code> option
172290001Sglebius(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>).  <code>more-help</code> will print
173290001Sglebiusthe usage text by passing it through a pager program. 
174290001Sglebius<code>more-help</code> is disabled on platforms without a working
175290001Sglebius<code>fork(2)</code> function.  The <code>PAGER</code> environment variable is
176290001Sglebiusused to select the program, defaulting to <span class="file">more</span>.  Both will exit
177290001Sglebiuswith a status code of 0.
178290001Sglebius
179310419Sdelphij<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p9
180290001SglebiusUsage:  sntp [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
181290001Sglebius                [ hostname-or-IP ...]
182290001Sglebius  Flg Arg Option-Name    Description
183290001Sglebius   -4 no  ipv4           Force IPv4 DNS name resolution
184290001Sglebius                                - prohibits the option 'ipv6'
185290001Sglebius   -6 no  ipv6           Force IPv6 DNS name resolution
186290001Sglebius                                - prohibits the option 'ipv4'
187290001Sglebius   -a Num authentication Enable authentication with the key auth-keynumber
188290001Sglebius   -b Str broadcast      Listen to the address specified for broadcast time sync
189290001Sglebius                                - may appear multiple times
190290001Sglebius   -c Str concurrent     Concurrently query all IPs returned for host-name
191290001Sglebius                                - may appear multiple times
192290001Sglebius   -d no  debug-level    Increase debug verbosity level
193290001Sglebius                                - may appear multiple times
194290001Sglebius   -D Num set-debug-level Set the debug verbosity level
195290001Sglebius                                - may appear multiple times
196290001Sglebius   -g Num gap            The gap (in milliseconds) between time requests
197290001Sglebius   -K Fil kod            KoD history filename
198290001Sglebius   -k Fil keyfile        Look in this file for the key specified with -a
199290001Sglebius   -l Fil logfile        Log to specified logfile
200290001Sglebius   -M Num steplimit      Adjustments less than steplimit msec will be slewed
201290001Sglebius                                - it must be in the range:
202290001Sglebius                                  greater than or equal to 0
203290001Sglebius   -o Num ntpversion     Send int as our NTP protocol version
204290001Sglebius                                - it must be in the range:
205290001Sglebius                                  0 to 7
206290001Sglebius   -r no  usereservedport Use the NTP Reserved Port (port 123)
207290001Sglebius   -S no  step           OK to 'step' the time with settimeofday(2)
208290001Sglebius   -s no  slew           OK to 'slew' the time with adjtime(2)
209290001Sglebius   -t Num timeout        The number of seconds to wait for responses
210290001Sglebius      no  wait           Wait for pending replies (if not setting the time)
211290001Sglebius                                - disabled as '--no-wait'
212290001Sglebius                                - enabled by default
213290001Sglebius      opt version        output version information and exit
214290001Sglebius   -? no  help           display extended usage information and exit
215290001Sglebius   -! no  more-help      extended usage information passed thru pager
216290001Sglebius   -&gt; opt save-opts      save the option state to a config file
217290001Sglebius   -&lt; Str load-opts      load options from a config file
218290001Sglebius                                - disabled as '--no-load-opts'
219290001Sglebius                                - may appear multiple times
220290001Sglebius
221290001SglebiusOptions are specified by doubled hyphens and their name or by a single
222290001Sglebiushyphen and the flag character.
223290001Sglebius
224290001Sglebius
225290001SglebiusThe following option preset mechanisms are supported:
226290001Sglebius - reading file $HOME/.ntprc
227290001Sglebius - reading file ./.ntprc
228290001Sglebius - examining environment variables named SNTP_*
229290001Sglebius
230290001SglebiusPlease send bug reports to:  &lt;http://bugs.ntp.org, bugs@ntp.org&gt;
231290001Sglebius</pre>
232290001Sglebius  <div class="node">
233290001Sglebius<p><hr>
234290001Sglebius<a name="sntp-ipv4"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-ipv6">sntp ipv6</a>,
235290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-usage">sntp usage</a>,
236290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
237290001Sglebius<br>
238290001Sglebius</div>
239290001Sglebius
240290001Sglebius<h4 class="subsection">ipv4 option (-4)</h4>
241290001Sglebius
242290001Sglebius<p><a name="index-sntp_002dipv4-4"></a>
243290001SglebiusThis is the &ldquo;force ipv4 dns name resolution&rdquo; option.
244290001Sglebius
245290001Sglebius<p class="noindent">This option has some usage constraints.  It:
246290001Sglebius     <ul>
247290001Sglebius<li>must not appear in combination with any of the following options:
248290001Sglebiusipv6. 
249290001Sglebius</ul>
250290001Sglebius
251290001Sglebius  <p>Force DNS resolution of the following host names on the command line
252290001Sglebiusto the IPv4 namespace. 
253290001Sglebius<div class="node">
254290001Sglebius<p><hr>
255290001Sglebius<a name="sntp-ipv6"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-authentication">sntp authentication</a>,
256290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-ipv4">sntp ipv4</a>,
257290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
258290001Sglebius<br>
259290001Sglebius</div>
260290001Sglebius
261290001Sglebius<h4 class="subsection">ipv6 option (-6)</h4>
262290001Sglebius
263290001Sglebius<p><a name="index-sntp_002dipv6-5"></a>
264290001SglebiusThis is the &ldquo;force ipv6 dns name resolution&rdquo; option.
265290001Sglebius
266290001Sglebius<p class="noindent">This option has some usage constraints.  It:
267290001Sglebius     <ul>
268290001Sglebius<li>must not appear in combination with any of the following options:
269290001Sglebiusipv4. 
270290001Sglebius</ul>
271290001Sglebius
272290001Sglebius  <p>Force DNS resolution of the following host names on the command line
273290001Sglebiusto the IPv6 namespace. 
274290001Sglebius<div class="node">
275290001Sglebius<p><hr>
276290001Sglebius<a name="sntp-authentication"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-broadcast">sntp broadcast</a>,
277290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-ipv6">sntp ipv6</a>,
278290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
279290001Sglebius<br>
280290001Sglebius</div>
281290001Sglebius
282290001Sglebius<h4 class="subsection">authentication option (-a)</h4>
283290001Sglebius
284290001Sglebius<p><a name="index-sntp_002dauthentication-6"></a>
285290001SglebiusThis is the &ldquo;enable authentication with the key <var>auth-keynumber</var>&rdquo; option. 
286290001SglebiusThis option takes a number argument <span class="file">auth-keynumber</span>. 
287290001SglebiusEnable authentication using the key specified in this option's
288290001Sglebiusargument.  The argument of this option is the <span class="option">keyid</span>, a
289290001Sglebiusnumber specified in the <span class="option">keyfile</span> as this key's identifier. 
290290001SglebiusSee the <span class="option">keyfile</span> option (<span class="option">-k</span>) for more details. 
291290001Sglebius<div class="node">
292290001Sglebius<p><hr>
293290001Sglebius<a name="sntp-broadcast"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-concurrent">sntp concurrent</a>,
294290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-authentication">sntp authentication</a>,
295290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
296290001Sglebius<br>
297290001Sglebius</div>
298290001Sglebius
299290001Sglebius<h4 class="subsection">broadcast option (-b)</h4>
300290001Sglebius
301290001Sglebius<p><a name="index-sntp_002dbroadcast-7"></a>
302290001SglebiusThis is the &ldquo;listen to the address specified for broadcast time sync&rdquo; option. 
303290001SglebiusThis option takes a string argument <span class="file">broadcast-address</span>.
304290001Sglebius
305290001Sglebius<p class="noindent">This option has some usage constraints.  It:
306290001Sglebius     <ul>
307290001Sglebius<li>may appear an unlimited number of times. 
308290001Sglebius</ul>
309290001Sglebius
310290001Sglebius  <p>If specified <code>sntp</code> will listen to the specified address
311290001Sglebiusfor NTP broadcasts.  The default maximum wait time
312290001Sglebiuscan (and probably should) be modified with <span class="option">-t</span>. 
313290001Sglebius<div class="node">
314290001Sglebius<p><hr>
315290001Sglebius<a name="sntp-concurrent"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-gap">sntp gap</a>,
316290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-broadcast">sntp broadcast</a>,
317290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
318290001Sglebius<br>
319290001Sglebius</div>
320290001Sglebius
321290001Sglebius<h4 class="subsection">concurrent option (-c)</h4>
322290001Sglebius
323290001Sglebius<p><a name="index-sntp_002dconcurrent-8"></a>
324290001SglebiusThis is the &ldquo;concurrently query all ips returned for host-name&rdquo; option. 
325290001SglebiusThis option takes a string argument <span class="file">host-name</span>.
326290001Sglebius
327290001Sglebius<p class="noindent">This option has some usage constraints.  It:
328290001Sglebius     <ul>
329290001Sglebius<li>may appear an unlimited number of times. 
330290001Sglebius</ul>
331290001Sglebius
332290001Sglebius  <p>Requests from an NTP "client" to a "server" should never be sent
333290001Sglebiusmore rapidly than one every 2 seconds.  By default, any IPs returned
334290001Sglebiusas part of a DNS lookup are assumed to be for a single instance of
335290001Sglebius<code>ntpd</code>, and therefore <code>sntp</code> will send queries to these IPs
336290001Sglebiusone after another, with a 2-second gap in between each query.
337290001Sglebius
338290001Sglebius  <p>The <span class="option">-c</span> or <span class="option">--concurrent</span> flag says that any IPs
339290001Sglebiusreturned for the DNS lookup of the supplied host-name are on
340290001Sglebiusdifferent machines, so we can send concurrent queries. 
341290001Sglebius<div class="node">
342290001Sglebius<p><hr>
343290001Sglebius<a name="sntp-gap"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-kod">sntp kod</a>,
344290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-concurrent">sntp concurrent</a>,
345290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
346290001Sglebius<br>
347290001Sglebius</div>
348290001Sglebius
349290001Sglebius<h4 class="subsection">gap option (-g)</h4>
350290001Sglebius
351290001Sglebius<p><a name="index-sntp_002dgap-9"></a>
352290001SglebiusThis is the &ldquo;the gap (in milliseconds) between time requests&rdquo; option. 
353290001SglebiusThis option takes a number argument <span class="file">milliseconds</span>. 
354290001SglebiusSince we're only going to use the first valid response we get and
355290001Sglebiusthere is benefit to specifying a good number of servers to query,
356290001Sglebiusseparate the queries we send out by the specified number of
357290001Sglebiusmilliseconds. 
358290001Sglebius<div class="node">
359290001Sglebius<p><hr>
360290001Sglebius<a name="sntp-kod"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-keyfile">sntp keyfile</a>,
361290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-gap">sntp gap</a>,
362290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
363290001Sglebius<br>
364290001Sglebius</div>
365290001Sglebius
366290001Sglebius<h4 class="subsection">kod option (-K)</h4>
367290001Sglebius
368290001Sglebius<p><a name="index-sntp_002dkod-10"></a>
369290001SglebiusThis is the &ldquo;kod history filename&rdquo; option. 
370290001SglebiusThis option takes a file argument <span class="file">file-name</span>. 
371290001SglebiusSpecifies the filename to be used for the persistent history of KoD
372290001Sglebiusresponses received from servers.  If the file does not exist, a
373290001Sglebiuswarning message will be displayed.  The file will not be created. 
374290001Sglebius<div class="node">
375290001Sglebius<p><hr>
376290001Sglebius<a name="sntp-keyfile"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-logfile">sntp logfile</a>,
377290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-kod">sntp kod</a>,
378290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
379290001Sglebius<br>
380290001Sglebius</div>
381290001Sglebius
382290001Sglebius<h4 class="subsection">keyfile option (-k)</h4>
383290001Sglebius
384290001Sglebius<p><a name="index-sntp_002dkeyfile-11"></a>
385290001SglebiusThis is the &ldquo;look in this file for the key specified with <span class="option">-a</span>&rdquo; option. 
386290001SglebiusThis option takes a file argument <span class="file">file-name</span>. 
387290001SglebiusThis option specifies the keyfile. 
388290001Sglebius<code>sntp</code> will search for the key specified with <span class="option">-a</span>
389290001Sglebius<span class="file">keyno</span> in this file.  See <span class="command">ntp.keys(5)</span> for more
390290001Sglebiusinformation. 
391290001Sglebius<div class="node">
392290001Sglebius<p><hr>
393290001Sglebius<a name="sntp-logfile"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-steplimit">sntp steplimit</a>,
394290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-keyfile">sntp keyfile</a>,
395290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
396290001Sglebius<br>
397290001Sglebius</div>
398290001Sglebius
399290001Sglebius<h4 class="subsection">logfile option (-l)</h4>
400290001Sglebius
401290001Sglebius<p><a name="index-sntp_002dlogfile-12"></a>
402290001SglebiusThis is the &ldquo;log to specified logfile&rdquo; option. 
403290001SglebiusThis option takes a file argument <span class="file">file-name</span>. 
404290001SglebiusThis option causes the client to write log messages to the specified
405290001Sglebius<span class="file">logfile</span>. 
406290001Sglebius<div class="node">
407290001Sglebius<p><hr>
408290001Sglebius<a name="sntp-steplimit"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-ntpversion">sntp ntpversion</a>,
409290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-logfile">sntp logfile</a>,
410290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
411290001Sglebius<br>
412290001Sglebius</div>
413290001Sglebius
414290001Sglebius<h4 class="subsection">steplimit option (-M)</h4>
415290001Sglebius
416290001Sglebius<p><a name="index-sntp_002dsteplimit-13"></a>
417290001SglebiusThis is the &ldquo;adjustments less than <var>steplimit</var> msec will be slewed&rdquo; option. 
418290001SglebiusThis option takes a number argument. 
419290001SglebiusIf the time adjustment is less than <span class="file">steplimit</span> milliseconds,
420290001Sglebiusslew the amount using <span class="command">adjtime(2)</span>.  Otherwise, step the
421290001Sglebiuscorrection using <span class="command">settimeofday(2)</span>.  The default value is 0,
422290001Sglebiuswhich means all adjustments will be stepped.  This is a feature, as
423290001Sglebiusdifferent situations demand different values. 
424290001Sglebius<div class="node">
425290001Sglebius<p><hr>
426290001Sglebius<a name="sntp-ntpversion"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-usereservedport">sntp usereservedport</a>,
427290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-steplimit">sntp steplimit</a>,
428290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
429290001Sglebius<br>
430290001Sglebius</div>
431290001Sglebius
432290001Sglebius<h4 class="subsection">ntpversion option (-o)</h4>
433290001Sglebius
434290001Sglebius<p><a name="index-sntp_002dntpversion-14"></a>
435290001SglebiusThis is the &ldquo;send <var>int</var> as our ntp protocol version&rdquo; option. 
436290001SglebiusThis option takes a number argument. 
437290001SglebiusWhen sending requests to a remote server, tell them we are running
438290001SglebiusNTP protocol version <span class="file">ntpversion</span> . 
439290001Sglebius<div class="node">
440290001Sglebius<p><hr>
441290001Sglebius<a name="sntp-usereservedport"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-timeout">sntp timeout</a>,
442290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-ntpversion">sntp ntpversion</a>,
443290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
444290001Sglebius<br>
445290001Sglebius</div>
446290001Sglebius
447290001Sglebius<h4 class="subsection">usereservedport option (-r)</h4>
448290001Sglebius
449290001Sglebius<p><a name="index-sntp_002dusereservedport-15"></a>
450290001SglebiusThis is the &ldquo;use the ntp reserved port (port 123)&rdquo; option. 
451290001SglebiusUse port 123, which is reserved for NTP, for our network
452290001Sglebiuscommunications. 
453290001Sglebius<div class="node">
454290001Sglebius<p><hr>
455290001Sglebius<a name="sntp-timeout"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-wait">sntp wait</a>,
456290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-usereservedport">sntp usereservedport</a>,
457290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
458290001Sglebius<br>
459290001Sglebius</div>
460290001Sglebius
461290001Sglebius<h4 class="subsection">timeout option (-t)</h4>
462290001Sglebius
463290001Sglebius<p><a name="index-sntp_002dtimeout-16"></a>
464290001SglebiusThis is the &ldquo;the number of seconds to wait for responses&rdquo; option. 
465290001SglebiusThis option takes a number argument <span class="file">seconds</span>. 
466290001SglebiusWhen waiting for a reply, <code>sntp</code> will wait the number
467290001Sglebiusof seconds specified before giving up.  The default should be
468290001Sglebiusmore than enough for a unicast response.  If <code>sntp</code> is
469290001Sglebiusonly waiting for a broadcast response a longer timeout is
470290001Sglebiuslikely needed. 
471290001Sglebius<div class="node">
472290001Sglebius<p><hr>
473290001Sglebius<a name="sntp-wait"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-config">sntp config</a>,
474290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-timeout">sntp timeout</a>,
475290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
476290001Sglebius<br>
477290001Sglebius</div>
478290001Sglebius
479290001Sglebius<h4 class="subsection">wait option</h4>
480290001Sglebius
481290001Sglebius<p><a name="index-sntp_002dwait-17"></a>
482290001SglebiusThis is the &ldquo;wait for pending replies (if not setting the time)&rdquo; option.
483290001Sglebius
484290001Sglebius<p class="noindent">This option has some usage constraints.  It:
485290001Sglebius     <ul>
486290001Sglebius<li>can be disabled with &ndash;no-wait. 
487290001Sglebius<li>It is enabled by default. 
488290001Sglebius</ul>
489290001Sglebius
490290001Sglebius  <p>If we are not setting the time, wait for all pending responses.
491290001Sglebius
492290001Sglebius<div class="node">
493290001Sglebius<p><hr>
494290001Sglebius<a name="sntp-config"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-exit-status">sntp exit status</a>,
495290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-wait">sntp wait</a>,
496290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
497290001Sglebius<br>
498290001Sglebius</div>
499290001Sglebius
500290001Sglebius<h4 class="subsection">presetting/configuring sntp</h4>
501290001Sglebius
502290001Sglebius<p>Any option that is not marked as <i>not presettable</i> may be preset by
503290001Sglebiusloading 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
504290001Sglebiusthe options listed above in upper case and segmented with underscores. 
505290001SglebiusThe <code>SNTP</code> variable will be tokenized and parsed like
506290001Sglebiusthe command line.  The remaining variables are tested for existence and their
507290001Sglebiusvalues are treated like option arguments.
508290001Sglebius
509290001Sglebius<p class="noindent"><code>libopts</code> will search in 2 places for configuration files:
510290001Sglebius     <ul>
511290001Sglebius<li>$HOME
512290001Sglebius<li>$PWD
513290001Sglebius</ul>
514290001Sglebius  The environment variables <code>HOME</code>, and <code>PWD</code>
515290001Sglebiusare expanded and replaced when <span class="file">sntp</span> runs. 
516290001SglebiusFor any of these that are plain files, they are simply processed. 
517290001SglebiusFor any that are directories, then a file named <span class="file">.ntprc</span> is searched for
518290001Sglebiuswithin that directory and processed.
519290001Sglebius
520290001Sglebius  <p>Configuration files may be in a wide variety of formats. 
521290001SglebiusThe basic format is an option name followed by a value (argument) on the
522290001Sglebiussame line.  Values may be separated from the option name with a colon,
523290001Sglebiusequal sign or simply white space.  Values may be continued across multiple
524290001Sglebiuslines by escaping the newline with a backslash.
525290001Sglebius
526290001Sglebius  <p>Multiple programs may also share the same initialization file. 
527290001SglebiusCommon options are collected at the top, followed by program specific
528290001Sglebiussegments.  The segments are separated by lines like:
529290001Sglebius<pre class="example">    [SNTP]
530290001Sglebius</pre>
531290001Sglebius  <p class="noindent">or by
532290001Sglebius<pre class="example">    &lt;?program sntp&gt;
533290001Sglebius</pre>
534290001Sglebius  <p class="noindent">Do not mix these styles within one configuration file.
535290001Sglebius
536290001Sglebius  <p>Compound values and carefully constructed string values may also be
537290001Sglebiusspecified using XML syntax:
538290001Sglebius<pre class="example">    &lt;option-name&gt;
539290001Sglebius       &lt;sub-opt&gt;...&amp;lt;...&amp;gt;...&lt;/sub-opt&gt;
540290001Sglebius    &lt;/option-name&gt;
541290001Sglebius</pre>
542290001Sglebius  <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of
543290001Sglebius<pre class="example">    "...&lt;...&gt;..."
544290001Sglebius</pre>
545290001Sglebius  <p><code>AutoOpts</code> does not track suboptions.  You simply note that it is a
546290001Sglebiushierarchicly valued option.  <code>AutoOpts</code> does provide a means for searching
547290001Sglebiusthe associated name/value pair list (see: optionFindValue).
548290001Sglebius
549290001Sglebius  <p>The command line options relating to configuration and/or usage help are:
550290001Sglebius
551290001Sglebius<h5 class="subsubheading">version (-)</h5>
552290001Sglebius
553290001Sglebius<p>Print the program version to standard out, optionally with licensing
554290001Sglebiusinformation, then exit 0.  The optional argument specifies how much licensing
555290001Sglebiusdetail to provide.  The default is to print just the version.  The licensing infomation may be selected with an option argument. 
556290001SglebiusOnly the first letter of the argument is examined:
557290001Sglebius
558290001Sglebius     <dl>
559290001Sglebius<dt><span class="samp">version</span><dd>Only print the version.  This is the default. 
560290001Sglebius<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 
561290001Sglebius<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 
562290001Sglebius</dl>
563290001Sglebius
564290001Sglebius<div class="node">
565290001Sglebius<p><hr>
566290001Sglebius<a name="sntp-exit-status"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-Usage">sntp Usage</a>,
567290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-config">sntp config</a>,
568290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
569290001Sglebius<br>
570290001Sglebius</div>
571290001Sglebius
572290001Sglebius<h4 class="subsection">sntp exit status</h4>
573290001Sglebius
574290001Sglebius<p>One of the following exit values will be returned:
575290001Sglebius     <dl>
576290001Sglebius<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 
577290001Sglebius<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 
578290001Sglebius<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 
579290001Sglebius<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error.  Please report
580290001Sglebiusit to autogen-users@lists.sourceforge.net.  Thank you. 
581290001Sglebius</dl>
582290001Sglebius  <div class="node">
583290001Sglebius<p><hr>
584290001Sglebius<a name="sntp-Usage"></a>Next:&nbsp;<a rel="next" accesskey="n" href="#sntp-Authors">sntp Authors</a>,
585290001SglebiusPrevious:&nbsp;<a rel="previous" accesskey="p" href="#sntp-exit-status">sntp exit status</a>,
586290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
587290001Sglebius<br>
588290001Sglebius</div>
589290001Sglebius
590290001Sglebius<h4 class="subsection">sntp Usage</h4>
591290001Sglebius
592290001Sglebius<div class="node">
593290001Sglebius<p><hr>
594290001Sglebius<a name="sntp-Authors"></a>Previous:&nbsp;<a rel="previous" accesskey="p" href="#sntp-Usage">sntp Usage</a>,
595290001SglebiusUp:&nbsp;<a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a>
596290001Sglebius<br>
597290001Sglebius</div>
598290001Sglebius
599290001Sglebius<h4 class="subsection">sntp Authors</h4>
600290001Sglebius
601290001Sglebius<div class="node">
602290001Sglebius<p><hr>
603290001Sglebius<a name="Usage"></a>
604290001Sglebius<br>
605290001Sglebius</div>
606290001Sglebius
607290001Sglebius<!-- node-name,  next,  previous,  up -->
608290001Sglebius<h3 class="section">Usage</h3>
609290001Sglebius
610290001Sglebius<p>The simplest use of this program is as an unprivileged command to
611290001Sglebiuscheck the current time, offset, and error in the local clock. 
612290001SglebiusFor example:
613290001Sglebius
614290001Sglebius<pre class="example">    sntp ntpserver.somewhere
615290001Sglebius</pre>
616290001Sglebius  <p>With suitable privilege, it can be run as a command or in a
617290001Sglebius<code>crom</code> job to reset the local clock from a reliable server, like
618290001Sglebiusthe <code>ntpdate</code> and <code>rdate</code> commands. 
619290001SglebiusFor example:
620290001Sglebius
621290001Sglebius<pre class="example">    sntp -a ntpserver.somewhere
622290001Sglebius</pre>
623290001Sglebius  </body></html>
624290001Sglebius
625