sntp.html revision 338530
1258945Sroberto<html lang="en"> 2258945Sroberto<head> 3258945Sroberto<title>Sntp User's Manual</title> 4258945Sroberto<meta http-equiv="Content-Type" content="text/html"> 5258945Sroberto<meta name="description" content="Sntp User's Manual"> 6258945Sroberto<meta name="generator" content="makeinfo 4.7"> 7258945Sroberto<link title="Top" rel="top" href="#Top"> 8258945Sroberto<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 9258945Sroberto<meta http-equiv="Content-Style-Type" content="text/css"> 10258945Sroberto<style type="text/css"><!-- 11258945Sroberto pre.display { font-family:inherit } 12258945Sroberto pre.format { font-family:inherit } 13258945Sroberto pre.smalldisplay { font-family:inherit; font-size:smaller } 14258945Sroberto pre.smallformat { font-family:inherit; font-size:smaller } 15258945Sroberto pre.smallexample { font-size:smaller } 16258945Sroberto pre.smalllisp { font-size:smaller } 17258945Sroberto span.sc { font-variant:small-caps } 18258945Sroberto span.roman { font-family: serif; font-weight: normal; } 19258945Sroberto--></style> 20258945Sroberto</head> 21258945Sroberto<body> 22258945Sroberto<h1 class="settitle">Sntp User's Manual</h1> 23258945Sroberto<div class="node"> 24258945Sroberto<p><hr> 25258945Sroberto<a name="Top"></a>Next: <a rel="next" accesskey="n" href="#sntp-Description">sntp Description</a>, 26258945SrobertoPrevious: <a rel="previous" accesskey="p" href="#dir">(dir)</a>, 27258945SrobertoUp: <a rel="up" accesskey="u" href="#dir">(dir)</a> 28258945Sroberto<br> 29258945Sroberto</div> 30258945Sroberto 31258945Sroberto<h2 class="unnumbered">Simple Network Time Protocol User Manual</h2> 32258945Sroberto 33258945Sroberto<p>This document describes the use of the NTP Project's <code>sntp</code> program, 34258945Srobertothat can be used to query a Network Time Protocol (NTP) server and 35258945Srobertodisplay the time offset of the system clock relative to the server 36258945Srobertoclock. Run as root, it can correct the system clock to this offset as 37258945Srobertowell. It can be run as an interactive command or from a cron job. 38258945Sroberto 39338530Sdelphij <p>This document applies to version 4.2.8p12 of <code>sntp</code>. 40258945Sroberto 41258945Sroberto <p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 42258945SrobertoIETF specification. 43258945Sroberto 44258945Sroberto <div class="shortcontents"> 45258945Sroberto<h2>Short Contents</h2> 46258945Sroberto<ul> 47258945Sroberto<a href="#Top">Simple Network Time Protocol User Manual</a> 48258945Sroberto</ul> 49258945Sroberto</div> 50258945Sroberto 51258945Sroberto<ul class="menu"> 52258945Sroberto<li><a accesskey="1" href="#sntp-Description">sntp Description</a>: Description 53258945Sroberto<li><a accesskey="2" href="#sntp-Invocation">sntp Invocation</a>: Invoking sntp 54258945Sroberto<li><a accesskey="3" href="#Usage">Usage</a>: Usage 55258945Sroberto</ul> 56258945Sroberto 57258945Sroberto<div class="node"> 58258945Sroberto<p><hr> 59258945Sroberto<a name="sntp-Description"></a> 60258945Sroberto<br> 61258945Sroberto</div> 62258945Sroberto 63258945Sroberto<!-- node-name, next, previous, up --> 64258945Sroberto<h3 class="section">Description</h3> 65258945Sroberto 66258945Sroberto<p>By default, <code>sntp</code> writes the local data and time (i.e., not UTC) to the 67258945Srobertostandard output in the format: 68258945Sroberto 69280849Scy<pre class="example"> 1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs 70258945Sroberto</pre> 71280849Scy <p>where 72280849ScyYYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time, 73280849Scy(+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC), 74280849Scyand 75280849Scythe +4.567 +/- 0.089 secs indicates the time offset and 76258945Srobertoerror bound of the system clock relative to the server clock. 77258945Sroberto 78258945Sroberto<div class="node"> 79258945Sroberto<p><hr> 80258945Sroberto<a name="sntp-Invocation"></a> 81258945Sroberto<br> 82258945Sroberto</div> 83258945Sroberto 84258945Sroberto<h3 class="section">Invoking sntp</h3> 85258945Sroberto 86280849Scy<p><a name="index-sntp-1"></a><a name="index-standard-Simple-Network-Time-Protocol-client-program-2"></a> 87280849Scy 88280849Scy <p><code>sntp</code> 89280849Scycan be used as an SNTP client to query a NTP or SNTP server and either display 90258945Srobertothe time or set the local system's time (given suitable privilege). It can be 91280849Scyrun as an interactive command or from a 92258945Sroberto<code>cron</code> 93258945Srobertojob. 94258945Sroberto 95258945Sroberto <p>NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) 96258945Srobertoare defined and described by RFC 5905. 97258945Sroberto 98280849Scy <p>The default is to write the estimated correct local date and time (i.e. not 99280849ScyUTC) to the standard output in a format like: 100280849Scy 101280849Scy <p><code>'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'</code> 102280849Scy 103258945Sroberto <p>where the 104280849Scy<code>'(+0800)'</code> 105280849Scymeans that to get to UTC from the reported local time one must 106280849Scyadd 8 hours and 0 minutes, 107280849Scythe 108280849Scy<code>'+4.567'</code> 109280849Scyindicates the local clock is 4.567 seconds behind the correct time 110280849Scy(so 4.567 seconds must be added to the local clock to get it to be correct). 111280849ScyNote that the number of decimals printed for this value will change 112280849Scybased on the reported precision of the server. 113280849Scy<code>'+/- 0.089'</code> 114280849Scyis the reported 115280849Scy<em>synchronization</em> <em>distance</em> 116280849Scy(in seconds), which represents the maximum error due to all causes. 117280849ScyIf the server does not report valid data needed to calculate the 118280849Scysynchronization distance, this will be reported as 119280849Scy<code>'+/- ?'</code>. 120280849ScyIf the 121280849Scy<em>host</em> 122280849Scyis different from the 123280849Scy<em>IP</em>, 124280849Scyboth will be displayed. 125280849ScyOtherwise, only the 126280849Scy<em>IP</em> 127280849Scyis displayed. 128280849ScyFinally, the 129280849Scy<em>stratum</em> 130282408Scyof the host is reported 131282408Scyand the leap indicator is decoded and displayed. 132258945Sroberto 133258945Sroberto <p>This section was generated by <strong>AutoGen</strong>, 134280849Scyusing the <code>agtexi-cmd</code> template and the option descriptions for the <code>sntp</code> program. 135280849ScyThis software is released under the NTP license, <http://ntp.org/license>. 136258945Sroberto 137258945Sroberto<ul class="menu"> 138280849Scy<li><a accesskey="1" href="#sntp-usage">sntp usage</a>: sntp help/usage (<span class="option">--help</span>) 139280849Scy<li><a accesskey="2" href="#sntp-ipv4">sntp ipv4</a>: ipv4 option (-4) 140280849Scy<li><a accesskey="3" href="#sntp-ipv6">sntp ipv6</a>: ipv6 option (-6) 141280849Scy<li><a accesskey="4" href="#sntp-authentication">sntp authentication</a>: authentication option (-a) 142280849Scy<li><a accesskey="5" href="#sntp-broadcast">sntp broadcast</a>: broadcast option (-b) 143280849Scy<li><a accesskey="6" href="#sntp-concurrent">sntp concurrent</a>: concurrent option (-c) 144280849Scy<li><a accesskey="7" href="#sntp-gap">sntp gap</a>: gap option (-g) 145280849Scy<li><a accesskey="8" href="#sntp-kod">sntp kod</a>: kod option (-K) 146280849Scy<li><a accesskey="9" href="#sntp-keyfile">sntp keyfile</a>: keyfile option (-k) 147280849Scy<li><a href="#sntp-logfile">sntp logfile</a>: logfile option (-l) 148280849Scy<li><a href="#sntp-steplimit">sntp steplimit</a>: steplimit option (-M) 149280849Scy<li><a href="#sntp-ntpversion">sntp ntpversion</a>: ntpversion option (-o) 150280849Scy<li><a href="#sntp-usereservedport">sntp usereservedport</a>: usereservedport option (-r) 151280849Scy<li><a href="#sntp-timeout">sntp timeout</a>: timeout option (-t) 152280849Scy<li><a href="#sntp-wait">sntp wait</a>: wait option 153280849Scy<li><a href="#sntp-config">sntp config</a>: presetting/configuring sntp 154280849Scy<li><a href="#sntp-exit-status">sntp exit status</a>: exit status 155280849Scy<li><a href="#sntp-Usage">sntp Usage</a>: Usage 156280849Scy<li><a href="#sntp-Authors">sntp Authors</a>: Authors 157258945Sroberto</ul> 158258945Sroberto 159258945Sroberto<div class="node"> 160258945Sroberto<p><hr> 161280849Scy<a name="sntp-usage"></a>Next: <a rel="next" accesskey="n" href="#sntp-ipv4">sntp ipv4</a>, 162258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 163258945Sroberto<br> 164258945Sroberto</div> 165258945Sroberto 166280849Scy<h4 class="subsection">sntp help/usage (<span class="option">--help</span>)</h4> 167258945Sroberto 168280849Scy<p><a name="index-sntp-help-3"></a> 169280849ScyThis is the automatically generated usage text for sntp. 170258945Sroberto 171280849Scy <p>The text printed is the same whether selected with the <code>help</code> option 172280849Scy(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print 173280849Scythe usage text by passing it through a pager program. 174280849Scy<code>more-help</code> is disabled on platforms without a working 175280849Scy<code>fork(2)</code> function. The <code>PAGER</code> environment variable is 176280849Scyused to select the program, defaulting to <span class="file">more</span>. Both will exit 177280849Scywith a status code of 0. 178280849Scy 179338530Sdelphij<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p12 180338530SdelphijUsage: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \ 181258945Sroberto [ hostname-or-IP ...] 182258945Sroberto Flg Arg Option-Name Description 183258945Sroberto -4 no ipv4 Force IPv4 DNS name resolution 184338530Sdelphij - prohibits the option 'ipv6' 185258945Sroberto -6 no ipv6 Force IPv6 DNS name resolution 186338530Sdelphij - prohibits the option 'ipv4' 187338530Sdelphij -a Num authentication Enable authentication with the key auth-keynumber 188280849Scy -b Str broadcast Listen to the address specified for broadcast time sync 189258945Sroberto - may appear multiple times 190280849Scy -c Str concurrent Concurrently query all IPs returned for host-name 191280849Scy - may appear multiple times 192280849Scy -d no debug-level Increase debug verbosity level 193280849Scy - may appear multiple times 194338530Sdelphij -D Num set-debug-level Set the debug verbosity level 195280849Scy - may appear multiple times 196280849Scy -g Num gap The gap (in milliseconds) between time requests 197280849Scy -K Fil kod KoD history filename 198338530Sdelphij -k Fil keyfile Look in this file for the key specified with -a 199280849Scy -l Fil logfile Log to specified logfile 200338530Sdelphij -M Num steplimit Adjustments less than steplimit msec will be slewed 201338530Sdelphij - it must be in the range: 202280849Scy greater than or equal to 0 203338530Sdelphij -o Num ntpversion Send int as our NTP protocol version 204338530Sdelphij - it must be in the range: 205280849Scy 0 to 7 206280849Scy -r no usereservedport Use the NTP Reserved Port (port 123) 207338530Sdelphij -S no step OK to 'step' the time with settimeofday(2) 208338530Sdelphij -s no slew OK to 'slew' the time with adjtime(2) 209338530Sdelphij -t Num timeout The number of seconds to wait for responses 210280849Scy no wait Wait for pending replies (if not setting the time) 211338530Sdelphij - disabled as '--no-wait' 212280849Scy - enabled by default 213338530Sdelphij opt version output version information and exit 214338530Sdelphij -? no help display extended usage information and exit 215338530Sdelphij -! no more-help extended usage information passed thru pager 216338530Sdelphij -> opt save-opts save the option state to a config file 217338530Sdelphij -< Str load-opts load options from a config file 218338530Sdelphij - disabled as '--no-load-opts' 219280849Scy - may appear multiple times 220258945Sroberto 221258945SrobertoOptions are specified by doubled hyphens and their name or by a single 222258945Srobertohyphen and the flag character. 223258945Sroberto 224258945Sroberto 225258945SrobertoThe following option preset mechanisms are supported: 226258945Sroberto - reading file $HOME/.ntprc 227258945Sroberto - reading file ./.ntprc 228258945Sroberto - examining environment variables named SNTP_* 229258945Sroberto 230338530SdelphijPlease send bug reports to: <http://bugs.ntp.org, bugs@ntp.org> 231258945Sroberto</pre> 232258945Sroberto <div class="node"> 233258945Sroberto<p><hr> 234280849Scy<a name="sntp-ipv4"></a>Next: <a rel="next" accesskey="n" href="#sntp-ipv6">sntp ipv6</a>, 235258945SrobertoPrevious: <a rel="previous" accesskey="p" href="#sntp-usage">sntp usage</a>, 236258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 237258945Sroberto<br> 238258945Sroberto</div> 239258945Sroberto 240280849Scy<h4 class="subsection">ipv4 option (-4)</h4> 241258945Sroberto 242280849Scy<p><a name="index-sntp_002dipv4-4"></a> 243280849ScyThis is the “force ipv4 dns name resolution” option. 244258945Sroberto 245280849Scy<p class="noindent">This option has some usage constraints. It: 246258945Sroberto <ul> 247258945Sroberto<li>must not appear in combination with any of the following options: 248280849Scyipv6. 249258945Sroberto</ul> 250258945Sroberto 251280849Scy <p>Force DNS resolution of the following host names on the command line 252280849Scyto the IPv4 namespace. 253258945Sroberto<div class="node"> 254258945Sroberto<p><hr> 255280849Scy<a name="sntp-ipv6"></a>Next: <a rel="next" accesskey="n" href="#sntp-authentication">sntp authentication</a>, 256280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-ipv4">sntp ipv4</a>, 257258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 258258945Sroberto<br> 259258945Sroberto</div> 260258945Sroberto 261280849Scy<h4 class="subsection">ipv6 option (-6)</h4> 262258945Sroberto 263280849Scy<p><a name="index-sntp_002dipv6-5"></a> 264280849ScyThis is the “force ipv6 dns name resolution” option. 265258945Sroberto 266280849Scy<p class="noindent">This option has some usage constraints. It: 267280849Scy <ul> 268280849Scy<li>must not appear in combination with any of the following options: 269280849Scyipv4. 270280849Scy</ul> 271280849Scy 272280849Scy <p>Force DNS resolution of the following host names on the command line 273280849Scyto the IPv6 namespace. 274258945Sroberto<div class="node"> 275258945Sroberto<p><hr> 276280849Scy<a name="sntp-authentication"></a>Next: <a rel="next" accesskey="n" href="#sntp-broadcast">sntp broadcast</a>, 277280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-ipv6">sntp ipv6</a>, 278258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 279258945Sroberto<br> 280258945Sroberto</div> 281258945Sroberto 282280849Scy<h4 class="subsection">authentication option (-a)</h4> 283258945Sroberto 284280849Scy<p><a name="index-sntp_002dauthentication-6"></a> 285280849ScyThis is the “enable authentication with the key <var>auth-keynumber</var>” option. 286280849ScyThis option takes a number argument <span class="file">auth-keynumber</span>. 287280849ScyEnable authentication using the key specified in this option's 288280849Scyargument. The argument of this option is the <span class="option">keyid</span>, a 289280849Scynumber specified in the <span class="option">keyfile</span> as this key's identifier. 290280849ScySee the <span class="option">keyfile</span> option (<span class="option">-k</span>) for more details. 291258945Sroberto<div class="node"> 292258945Sroberto<p><hr> 293280849Scy<a name="sntp-broadcast"></a>Next: <a rel="next" accesskey="n" href="#sntp-concurrent">sntp concurrent</a>, 294280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-authentication">sntp authentication</a>, 295258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 296258945Sroberto<br> 297258945Sroberto</div> 298258945Sroberto 299280849Scy<h4 class="subsection">broadcast option (-b)</h4> 300258945Sroberto 301280849Scy<p><a name="index-sntp_002dbroadcast-7"></a> 302280849ScyThis is the “listen to the address specified for broadcast time sync” option. 303280849ScyThis option takes a string argument <span class="file">broadcast-address</span>. 304258945Sroberto 305280849Scy<p class="noindent">This option has some usage constraints. It: 306258945Sroberto <ul> 307280849Scy<li>may appear an unlimited number of times. 308258945Sroberto</ul> 309258945Sroberto 310280849Scy <p>If specified <code>sntp</code> will listen to the specified address 311280849Scyfor NTP broadcasts. The default maximum wait time 312280849Scycan (and probably should) be modified with <span class="option">-t</span>. 313258945Sroberto<div class="node"> 314258945Sroberto<p><hr> 315280849Scy<a name="sntp-concurrent"></a>Next: <a rel="next" accesskey="n" href="#sntp-gap">sntp gap</a>, 316280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-broadcast">sntp broadcast</a>, 317258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 318258945Sroberto<br> 319258945Sroberto</div> 320258945Sroberto 321280849Scy<h4 class="subsection">concurrent option (-c)</h4> 322258945Sroberto 323280849Scy<p><a name="index-sntp_002dconcurrent-8"></a> 324280849ScyThis is the “concurrently query all ips returned for host-name” option. 325280849ScyThis option takes a string argument <span class="file">host-name</span>. 326258945Sroberto 327280849Scy<p class="noindent">This option has some usage constraints. It: 328258945Sroberto <ul> 329280849Scy<li>may appear an unlimited number of times. 330258945Sroberto</ul> 331258945Sroberto 332280849Scy <p>Requests from an NTP "client" to a "server" should never be sent 333280849Scymore rapidly than one every 2 seconds. By default, any IPs returned 334280849Scyas part of a DNS lookup are assumed to be for a single instance of 335280849Scy<code>ntpd</code>, and therefore <code>sntp</code> will send queries to these IPs 336280849Scyone after another, with a 2-second gap in between each query. 337258945Sroberto 338280849Scy <p>The <span class="option">-c</span> or <span class="option">--concurrent</span> flag says that any IPs 339280849Scyreturned for the DNS lookup of the supplied host-name are on 340280849Scydifferent machines, so we can send concurrent queries. 341258945Sroberto<div class="node"> 342258945Sroberto<p><hr> 343280849Scy<a name="sntp-gap"></a>Next: <a rel="next" accesskey="n" href="#sntp-kod">sntp kod</a>, 344280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-concurrent">sntp concurrent</a>, 345258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 346258945Sroberto<br> 347258945Sroberto</div> 348258945Sroberto 349280849Scy<h4 class="subsection">gap option (-g)</h4> 350258945Sroberto 351280849Scy<p><a name="index-sntp_002dgap-9"></a> 352280849ScyThis is the “the gap (in milliseconds) between time requests” option. 353280849ScyThis option takes a number argument <span class="file">milliseconds</span>. 354280849ScySince we're only going to use the first valid response we get and 355280849Scythere is benefit to specifying a good number of servers to query, 356280849Scyseparate the queries we send out by the specified number of 357280849Scymilliseconds. 358258945Sroberto<div class="node"> 359258945Sroberto<p><hr> 360280849Scy<a name="sntp-kod"></a>Next: <a rel="next" accesskey="n" href="#sntp-keyfile">sntp keyfile</a>, 361280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-gap">sntp gap</a>, 362258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 363258945Sroberto<br> 364258945Sroberto</div> 365258945Sroberto 366258945Sroberto<h4 class="subsection">kod option (-K)</h4> 367258945Sroberto 368258945Sroberto<p><a name="index-sntp_002dkod-10"></a> 369258945SrobertoThis is the “kod history filename” option. 370280849ScyThis option takes a file argument <span class="file">file-name</span>. 371280849ScySpecifies the filename to be used for the persistent history of KoD 372280849Scyresponses received from servers. If the file does not exist, a 373280849Scywarning message will be displayed. The file will not be created. 374258945Sroberto<div class="node"> 375258945Sroberto<p><hr> 376280849Scy<a name="sntp-keyfile"></a>Next: <a rel="next" accesskey="n" href="#sntp-logfile">sntp logfile</a>, 377258945SrobertoPrevious: <a rel="previous" accesskey="p" href="#sntp-kod">sntp kod</a>, 378258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 379258945Sroberto<br> 380258945Sroberto</div> 381258945Sroberto 382280849Scy<h4 class="subsection">keyfile option (-k)</h4> 383280849Scy 384280849Scy<p><a name="index-sntp_002dkeyfile-11"></a> 385280849ScyThis is the “look in this file for the key specified with <span class="option">-a</span>” option. 386280849ScyThis option takes a file argument <span class="file">file-name</span>. 387280849ScyThis option specifies the keyfile. 388280849Scy<code>sntp</code> will search for the key specified with <span class="option">-a</span> 389280849Scy<span class="file">keyno</span> in this file. See <span class="command">ntp.keys(5)</span> for more 390280849Scyinformation. 391280849Scy<div class="node"> 392280849Scy<p><hr> 393280849Scy<a name="sntp-logfile"></a>Next: <a rel="next" accesskey="n" href="#sntp-steplimit">sntp steplimit</a>, 394280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-keyfile">sntp keyfile</a>, 395280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 396280849Scy<br> 397280849Scy</div> 398280849Scy 399258945Sroberto<h4 class="subsection">logfile option (-l)</h4> 400258945Sroberto 401280849Scy<p><a name="index-sntp_002dlogfile-12"></a> 402280849ScyThis is the “log to specified logfile” option. 403280849ScyThis option takes a file argument <span class="file">file-name</span>. 404280849ScyThis option causes the client to write log messages to the specified 405280849Scy<span class="file">logfile</span>. 406280849Scy<div class="node"> 407280849Scy<p><hr> 408280849Scy<a name="sntp-steplimit"></a>Next: <a rel="next" accesskey="n" href="#sntp-ntpversion">sntp ntpversion</a>, 409280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-logfile">sntp logfile</a>, 410280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 411280849Scy<br> 412280849Scy</div> 413258945Sroberto 414280849Scy<h4 class="subsection">steplimit option (-M)</h4> 415258945Sroberto 416280849Scy<p><a name="index-sntp_002dsteplimit-13"></a> 417280849ScyThis is the “adjustments less than <var>steplimit</var> msec will be slewed” option. 418280849ScyThis option takes a number argument. 419280849ScyIf the time adjustment is less than <span class="file">steplimit</span> milliseconds, 420280849Scyslew the amount using <span class="command">adjtime(2)</span>. Otherwise, step the 421280849Scycorrection using <span class="command">settimeofday(2)</span>. The default value is 0, 422280849Scywhich means all adjustments will be stepped. This is a feature, as 423280849Scydifferent situations demand different values. 424280849Scy<div class="node"> 425280849Scy<p><hr> 426280849Scy<a name="sntp-ntpversion"></a>Next: <a rel="next" accesskey="n" href="#sntp-usereservedport">sntp usereservedport</a>, 427280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-steplimit">sntp steplimit</a>, 428280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 429280849Scy<br> 430280849Scy</div> 431258945Sroberto 432280849Scy<h4 class="subsection">ntpversion option (-o)</h4> 433280849Scy 434280849Scy<p><a name="index-sntp_002dntpversion-14"></a> 435280849ScyThis is the “send <var>int</var> as our ntp protocol version” option. 436280849ScyThis option takes a number argument. 437280849ScyWhen sending requests to a remote server, tell them we are running 438280849ScyNTP protocol version <span class="file">ntpversion</span> . 439258945Sroberto<div class="node"> 440258945Sroberto<p><hr> 441280849Scy<a name="sntp-usereservedport"></a>Next: <a rel="next" accesskey="n" href="#sntp-timeout">sntp timeout</a>, 442280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-ntpversion">sntp ntpversion</a>, 443258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 444258945Sroberto<br> 445258945Sroberto</div> 446258945Sroberto 447280849Scy<h4 class="subsection">usereservedport option (-r)</h4> 448258945Sroberto 449280849Scy<p><a name="index-sntp_002dusereservedport-15"></a> 450280849ScyThis is the “use the ntp reserved port (port 123)” option. 451280849ScyUse port 123, which is reserved for NTP, for our network 452280849Scycommunications. 453280849Scy<div class="node"> 454280849Scy<p><hr> 455280849Scy<a name="sntp-timeout"></a>Next: <a rel="next" accesskey="n" href="#sntp-wait">sntp wait</a>, 456280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-usereservedport">sntp usereservedport</a>, 457280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 458280849Scy<br> 459280849Scy</div> 460258945Sroberto 461280849Scy<h4 class="subsection">timeout option (-t)</h4> 462280849Scy 463280849Scy<p><a name="index-sntp_002dtimeout-16"></a> 464280849ScyThis is the “the number of seconds to wait for responses” option. 465280849ScyThis option takes a number argument <span class="file">seconds</span>. 466280849ScyWhen waiting for a reply, <code>sntp</code> will wait the number 467280849Scyof seconds specified before giving up. The default should be 468280849Scymore than enough for a unicast response. If <code>sntp</code> is 469280849Scyonly waiting for a broadcast response a longer timeout is 470280849Scylikely needed. 471258945Sroberto<div class="node"> 472258945Sroberto<p><hr> 473280849Scy<a name="sntp-wait"></a>Next: <a rel="next" accesskey="n" href="#sntp-config">sntp config</a>, 474280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-timeout">sntp timeout</a>, 475258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 476258945Sroberto<br> 477258945Sroberto</div> 478258945Sroberto 479280849Scy<h4 class="subsection">wait option</h4> 480258945Sroberto 481280849Scy<p><a name="index-sntp_002dwait-17"></a> 482280849ScyThis is the “wait for pending replies (if not setting the time)” option. 483258945Sroberto 484280849Scy<p class="noindent">This option has some usage constraints. It: 485258945Sroberto <ul> 486280849Scy<li>can be disabled with –no-wait. 487280849Scy<li>It is enabled by default. 488258945Sroberto</ul> 489258945Sroberto 490280849Scy <p>If we are not setting the time, wait for all pending responses. 491280849Scy 492258945Sroberto<div class="node"> 493258945Sroberto<p><hr> 494280849Scy<a name="sntp-config"></a>Next: <a rel="next" accesskey="n" href="#sntp-exit-status">sntp exit status</a>, 495280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-wait">sntp wait</a>, 496258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 497258945Sroberto<br> 498258945Sroberto</div> 499258945Sroberto 500280849Scy<h4 class="subsection">presetting/configuring sntp</h4> 501258945Sroberto 502280849Scy<p>Any option that is not marked as <i>not presettable</i> may be preset by 503280849Scyloading values from configuration ("rc" or "ini") files, and values from environment variables named <code>SNTP</code> and <code>SNTP_<OPTION_NAME></code>. <code><OPTION_NAME></code> must be one of 504280849Scythe options listed above in upper case and segmented with underscores. 505280849ScyThe <code>SNTP</code> variable will be tokenized and parsed like 506280849Scythe command line. The remaining variables are tested for existence and their 507280849Scyvalues are treated like option arguments. 508258945Sroberto 509280849Scy<p class="noindent"><code>libopts</code> will search in 2 places for configuration files: 510258945Sroberto <ul> 511280849Scy<li>$HOME 512280849Scy<li>$PWD 513258945Sroberto</ul> 514280849Scy The environment variables <code>HOME</code>, and <code>PWD</code> 515280849Scyare expanded and replaced when <span class="file">sntp</span> runs. 516280849ScyFor any of these that are plain files, they are simply processed. 517280849ScyFor any that are directories, then a file named <span class="file">.ntprc</span> is searched for 518280849Scywithin that directory and processed. 519258945Sroberto 520280849Scy <p>Configuration files may be in a wide variety of formats. 521280849ScyThe basic format is an option name followed by a value (argument) on the 522280849Scysame line. Values may be separated from the option name with a colon, 523280849Scyequal sign or simply white space. Values may be continued across multiple 524280849Scylines by escaping the newline with a backslash. 525258945Sroberto 526280849Scy <p>Multiple programs may also share the same initialization file. 527280849ScyCommon options are collected at the top, followed by program specific 528280849Scysegments. The segments are separated by lines like: 529280849Scy<pre class="example"> [SNTP] 530280849Scy</pre> 531280849Scy <p class="noindent">or by 532280849Scy<pre class="example"> <?program sntp> 533280849Scy</pre> 534280849Scy <p class="noindent">Do not mix these styles within one configuration file. 535280849Scy 536280849Scy <p>Compound values and carefully constructed string values may also be 537280849Scyspecified using XML syntax: 538280849Scy<pre class="example"> <option-name> 539280849Scy <sub-opt>...&lt;...&gt;...</sub-opt> 540280849Scy </option-name> 541280849Scy</pre> 542280849Scy <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of 543280849Scy<pre class="example"> "...<...>..." 544280849Scy</pre> 545280849Scy <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a 546280849Scyhierarchicly valued option. <code>AutoOpts</code> does provide a means for searching 547280849Scythe associated name/value pair list (see: optionFindValue). 548280849Scy 549280849Scy <p>The command line options relating to configuration and/or usage help are: 550280849Scy 551280849Scy<h5 class="subsubheading">version (-)</h5> 552280849Scy 553280849Scy<p>Print the program version to standard out, optionally with licensing 554280849Scyinformation, then exit 0. The optional argument specifies how much licensing 555280849Scydetail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. 556280849ScyOnly the first letter of the argument is examined: 557280849Scy 558280849Scy <dl> 559280849Scy<dt><span class="samp">version</span><dd>Only print the version. This is the default. 560280849Scy<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 561280849Scy<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 562280849Scy</dl> 563280849Scy 564258945Sroberto<div class="node"> 565258945Sroberto<p><hr> 566280849Scy<a name="sntp-exit-status"></a>Next: <a rel="next" accesskey="n" href="#sntp-Usage">sntp Usage</a>, 567280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-config">sntp config</a>, 568258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 569258945Sroberto<br> 570258945Sroberto</div> 571258945Sroberto 572280849Scy<h4 class="subsection">sntp exit status</h4> 573258945Sroberto 574280849Scy<p>One of the following exit values will be returned: 575280849Scy <dl> 576280849Scy<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 577280849Scy<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 578280849Scy<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 579280849Scy<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report 580280849Scyit to autogen-users@lists.sourceforge.net. Thank you. 581280849Scy</dl> 582280849Scy <div class="node"> 583280849Scy<p><hr> 584280849Scy<a name="sntp-Usage"></a>Next: <a rel="next" accesskey="n" href="#sntp-Authors">sntp Authors</a>, 585280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-exit-status">sntp exit status</a>, 586280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 587280849Scy<br> 588280849Scy</div> 589258945Sroberto 590280849Scy<h4 class="subsection">sntp Usage</h4> 591280849Scy 592258945Sroberto<div class="node"> 593258945Sroberto<p><hr> 594280849Scy<a name="sntp-Authors"></a>Previous: <a rel="previous" accesskey="p" href="#sntp-Usage">sntp Usage</a>, 595280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 596280849Scy<br> 597280849Scy</div> 598280849Scy 599280849Scy<h4 class="subsection">sntp Authors</h4> 600280849Scy 601280849Scy<div class="node"> 602280849Scy<p><hr> 603258945Sroberto<a name="Usage"></a> 604258945Sroberto<br> 605258945Sroberto</div> 606258945Sroberto 607258945Sroberto<!-- node-name, next, previous, up --> 608258945Sroberto<h3 class="section">Usage</h3> 609258945Sroberto 610258945Sroberto<p>The simplest use of this program is as an unprivileged command to 611258945Srobertocheck the current time, offset, and error in the local clock. 612258945SrobertoFor example: 613258945Sroberto 614258945Sroberto<pre class="example"> sntp ntpserver.somewhere 615258945Sroberto</pre> 616258945Sroberto <p>With suitable privilege, it can be run as a command or in a 617258945Sroberto<code>crom</code> job to reset the local clock from a reliable server, like 618258945Srobertothe <code>ntpdate</code> and <code>rdate</code> commands. 619258945SrobertoFor example: 620258945Sroberto 621258945Sroberto<pre class="example"> sntp -a ntpserver.somewhere 622258945Sroberto</pre> 623258945Sroberto </body></html> 624258945Sroberto 625