sntp.html revision 280849
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 39280849Scy <p>This document applies to version 4.2.8p1 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> 130280849Scyof the host is reported. 131258945Sroberto 132258945Sroberto <p>This section was generated by <strong>AutoGen</strong>, 133280849Scyusing the <code>agtexi-cmd</code> template and the option descriptions for the <code>sntp</code> program. 134280849ScyThis software is released under the NTP license, <http://ntp.org/license>. 135258945Sroberto 136258945Sroberto<ul class="menu"> 137280849Scy<li><a accesskey="1" href="#sntp-usage">sntp usage</a>: sntp help/usage (<span class="option">--help</span>) 138280849Scy<li><a accesskey="2" href="#sntp-ipv4">sntp ipv4</a>: ipv4 option (-4) 139280849Scy<li><a accesskey="3" href="#sntp-ipv6">sntp ipv6</a>: ipv6 option (-6) 140280849Scy<li><a accesskey="4" href="#sntp-authentication">sntp authentication</a>: authentication option (-a) 141280849Scy<li><a accesskey="5" href="#sntp-broadcast">sntp broadcast</a>: broadcast option (-b) 142280849Scy<li><a accesskey="6" href="#sntp-concurrent">sntp concurrent</a>: concurrent option (-c) 143280849Scy<li><a accesskey="7" href="#sntp-gap">sntp gap</a>: gap option (-g) 144280849Scy<li><a accesskey="8" href="#sntp-kod">sntp kod</a>: kod option (-K) 145280849Scy<li><a accesskey="9" href="#sntp-keyfile">sntp keyfile</a>: keyfile option (-k) 146280849Scy<li><a href="#sntp-logfile">sntp logfile</a>: logfile option (-l) 147280849Scy<li><a href="#sntp-steplimit">sntp steplimit</a>: steplimit option (-M) 148280849Scy<li><a href="#sntp-ntpversion">sntp ntpversion</a>: ntpversion option (-o) 149280849Scy<li><a href="#sntp-usereservedport">sntp usereservedport</a>: usereservedport option (-r) 150280849Scy<li><a href="#sntp-timeout">sntp timeout</a>: timeout option (-t) 151280849Scy<li><a href="#sntp-wait">sntp wait</a>: wait option 152280849Scy<li><a href="#sntp-config">sntp config</a>: presetting/configuring sntp 153280849Scy<li><a href="#sntp-exit-status">sntp exit status</a>: exit status 154280849Scy<li><a href="#sntp-Usage">sntp Usage</a>: Usage 155280849Scy<li><a href="#sntp-Authors">sntp Authors</a>: Authors 156258945Sroberto</ul> 157258945Sroberto 158258945Sroberto<div class="node"> 159258945Sroberto<p><hr> 160280849Scy<a name="sntp-usage"></a>Next: <a rel="next" accesskey="n" href="#sntp-ipv4">sntp ipv4</a>, 161258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 162258945Sroberto<br> 163258945Sroberto</div> 164258945Sroberto 165280849Scy<h4 class="subsection">sntp help/usage (<span class="option">--help</span>)</h4> 166258945Sroberto 167280849Scy<p><a name="index-sntp-help-3"></a> 168280849ScyThis is the automatically generated usage text for sntp. 169258945Sroberto 170280849Scy <p>The text printed is the same whether selected with the <code>help</code> option 171280849Scy(<span class="option">--help</span>) or the <code>more-help</code> option (<span class="option">--more-help</span>). <code>more-help</code> will print 172280849Scythe usage text by passing it through a pager program. 173280849Scy<code>more-help</code> is disabled on platforms without a working 174280849Scy<code>fork(2)</code> function. The <code>PAGER</code> environment variable is 175280849Scyused to select the program, defaulting to <span class="file">more</span>. Both will exit 176280849Scywith a status code of 0. 177280849Scy 178280849Scy<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p1 179280849ScyUsage: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \ 180258945Sroberto [ hostname-or-IP ...] 181258945Sroberto Flg Arg Option-Name Description 182258945Sroberto -4 no ipv4 Force IPv4 DNS name resolution 183280849Scy - prohibits the option 'ipv6' 184258945Sroberto -6 no ipv6 Force IPv6 DNS name resolution 185280849Scy - prohibits the option 'ipv4' 186258945Sroberto -a Num authentication Enable authentication with the key auth-keynumber 187280849Scy -b Str broadcast Listen to the address specified for broadcast time sync 188258945Sroberto - may appear multiple times 189280849Scy -c Str concurrent Concurrently query all IPs returned for host-name 190280849Scy - may appear multiple times 191280849Scy -d no debug-level Increase debug verbosity level 192280849Scy - may appear multiple times 193280849Scy -D Num set-debug-level Set the debug verbosity level 194280849Scy - may appear multiple times 195280849Scy -g Num gap The gap (in milliseconds) between time requests 196280849Scy -K Fil kod KoD history filename 197280849Scy -k Fil keyfile Look in this file for the key specified with -a 198280849Scy -l Fil logfile Log to specified logfile 199280849Scy -M Num steplimit Adjustments less than steplimit msec will be slewed 200280849Scy - it must be in the range: 201280849Scy greater than or equal to 0 202280849Scy -o Num ntpversion Send int as our NTP protocol version 203280849Scy - it must be in the range: 204280849Scy 0 to 7 205280849Scy -r no usereservedport Use the NTP Reserved Port (port 123) 206280849Scy -S no step OK to 'step' the time with settimeofday(2) 207280849Scy -s no slew OK to 'slew' the time with adjtime(2) 208280849Scy -t Num timeout The number of seconds to wait for responses 209280849Scy no wait Wait for pending replies (if not setting the time) 210280849Scy - disabled as '--no-wait' 211280849Scy - enabled by default 212280849Scy opt version output version information and exit 213280849Scy -? no help display extended usage information and exit 214280849Scy -! no more-help extended usage information passed thru pager 215280849Scy -> opt save-opts save the option state to a config file 216280849Scy -< Str load-opts load options from a config file 217280849Scy - disabled as '--no-load-opts' 218280849Scy - may appear multiple times 219258945Sroberto 220258945SrobertoOptions are specified by doubled hyphens and their name or by a single 221258945Srobertohyphen and the flag character. 222258945Sroberto 223258945Sroberto 224258945SrobertoThe following option preset mechanisms are supported: 225258945Sroberto - reading file $HOME/.ntprc 226258945Sroberto - reading file ./.ntprc 227258945Sroberto - examining environment variables named SNTP_* 228258945Sroberto 229280849ScyPlease send bug reports to: <http://bugs.ntp.org, bugs@ntp.org> 230258945Sroberto</pre> 231258945Sroberto <div class="node"> 232258945Sroberto<p><hr> 233280849Scy<a name="sntp-ipv4"></a>Next: <a rel="next" accesskey="n" href="#sntp-ipv6">sntp ipv6</a>, 234258945SrobertoPrevious: <a rel="previous" accesskey="p" href="#sntp-usage">sntp usage</a>, 235258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 236258945Sroberto<br> 237258945Sroberto</div> 238258945Sroberto 239280849Scy<h4 class="subsection">ipv4 option (-4)</h4> 240258945Sroberto 241280849Scy<p><a name="index-sntp_002dipv4-4"></a> 242280849ScyThis is the “force ipv4 dns name resolution” option. 243258945Sroberto 244280849Scy<p class="noindent">This option has some usage constraints. It: 245258945Sroberto <ul> 246258945Sroberto<li>must not appear in combination with any of the following options: 247280849Scyipv6. 248258945Sroberto</ul> 249258945Sroberto 250280849Scy <p>Force DNS resolution of the following host names on the command line 251280849Scyto the IPv4 namespace. 252258945Sroberto<div class="node"> 253258945Sroberto<p><hr> 254280849Scy<a name="sntp-ipv6"></a>Next: <a rel="next" accesskey="n" href="#sntp-authentication">sntp authentication</a>, 255280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-ipv4">sntp ipv4</a>, 256258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 257258945Sroberto<br> 258258945Sroberto</div> 259258945Sroberto 260280849Scy<h4 class="subsection">ipv6 option (-6)</h4> 261258945Sroberto 262280849Scy<p><a name="index-sntp_002dipv6-5"></a> 263280849ScyThis is the “force ipv6 dns name resolution” option. 264258945Sroberto 265280849Scy<p class="noindent">This option has some usage constraints. It: 266280849Scy <ul> 267280849Scy<li>must not appear in combination with any of the following options: 268280849Scyipv4. 269280849Scy</ul> 270280849Scy 271280849Scy <p>Force DNS resolution of the following host names on the command line 272280849Scyto the IPv6 namespace. 273258945Sroberto<div class="node"> 274258945Sroberto<p><hr> 275280849Scy<a name="sntp-authentication"></a>Next: <a rel="next" accesskey="n" href="#sntp-broadcast">sntp broadcast</a>, 276280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-ipv6">sntp ipv6</a>, 277258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 278258945Sroberto<br> 279258945Sroberto</div> 280258945Sroberto 281280849Scy<h4 class="subsection">authentication option (-a)</h4> 282258945Sroberto 283280849Scy<p><a name="index-sntp_002dauthentication-6"></a> 284280849ScyThis is the “enable authentication with the key <var>auth-keynumber</var>” option. 285280849ScyThis option takes a number argument <span class="file">auth-keynumber</span>. 286280849ScyEnable authentication using the key specified in this option's 287280849Scyargument. The argument of this option is the <span class="option">keyid</span>, a 288280849Scynumber specified in the <span class="option">keyfile</span> as this key's identifier. 289280849ScySee the <span class="option">keyfile</span> option (<span class="option">-k</span>) for more details. 290258945Sroberto<div class="node"> 291258945Sroberto<p><hr> 292280849Scy<a name="sntp-broadcast"></a>Next: <a rel="next" accesskey="n" href="#sntp-concurrent">sntp concurrent</a>, 293280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-authentication">sntp authentication</a>, 294258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 295258945Sroberto<br> 296258945Sroberto</div> 297258945Sroberto 298280849Scy<h4 class="subsection">broadcast option (-b)</h4> 299258945Sroberto 300280849Scy<p><a name="index-sntp_002dbroadcast-7"></a> 301280849ScyThis is the “listen to the address specified for broadcast time sync” option. 302280849ScyThis option takes a string argument <span class="file">broadcast-address</span>. 303258945Sroberto 304280849Scy<p class="noindent">This option has some usage constraints. It: 305258945Sroberto <ul> 306280849Scy<li>may appear an unlimited number of times. 307258945Sroberto</ul> 308258945Sroberto 309280849Scy <p>If specified <code>sntp</code> will listen to the specified address 310280849Scyfor NTP broadcasts. The default maximum wait time 311280849Scycan (and probably should) be modified with <span class="option">-t</span>. 312258945Sroberto<div class="node"> 313258945Sroberto<p><hr> 314280849Scy<a name="sntp-concurrent"></a>Next: <a rel="next" accesskey="n" href="#sntp-gap">sntp gap</a>, 315280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-broadcast">sntp broadcast</a>, 316258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 317258945Sroberto<br> 318258945Sroberto</div> 319258945Sroberto 320280849Scy<h4 class="subsection">concurrent option (-c)</h4> 321258945Sroberto 322280849Scy<p><a name="index-sntp_002dconcurrent-8"></a> 323280849ScyThis is the “concurrently query all ips returned for host-name” option. 324280849ScyThis option takes a string argument <span class="file">host-name</span>. 325258945Sroberto 326280849Scy<p class="noindent">This option has some usage constraints. It: 327258945Sroberto <ul> 328280849Scy<li>may appear an unlimited number of times. 329258945Sroberto</ul> 330258945Sroberto 331280849Scy <p>Requests from an NTP "client" to a "server" should never be sent 332280849Scymore rapidly than one every 2 seconds. By default, any IPs returned 333280849Scyas part of a DNS lookup are assumed to be for a single instance of 334280849Scy<code>ntpd</code>, and therefore <code>sntp</code> will send queries to these IPs 335280849Scyone after another, with a 2-second gap in between each query. 336258945Sroberto 337280849Scy <p>The <span class="option">-c</span> or <span class="option">--concurrent</span> flag says that any IPs 338280849Scyreturned for the DNS lookup of the supplied host-name are on 339280849Scydifferent machines, so we can send concurrent queries. 340258945Sroberto<div class="node"> 341258945Sroberto<p><hr> 342280849Scy<a name="sntp-gap"></a>Next: <a rel="next" accesskey="n" href="#sntp-kod">sntp kod</a>, 343280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-concurrent">sntp concurrent</a>, 344258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 345258945Sroberto<br> 346258945Sroberto</div> 347258945Sroberto 348280849Scy<h4 class="subsection">gap option (-g)</h4> 349258945Sroberto 350280849Scy<p><a name="index-sntp_002dgap-9"></a> 351280849ScyThis is the “the gap (in milliseconds) between time requests” option. 352280849ScyThis option takes a number argument <span class="file">milliseconds</span>. 353280849ScySince we're only going to use the first valid response we get and 354280849Scythere is benefit to specifying a good number of servers to query, 355280849Scyseparate the queries we send out by the specified number of 356280849Scymilliseconds. 357258945Sroberto<div class="node"> 358258945Sroberto<p><hr> 359280849Scy<a name="sntp-kod"></a>Next: <a rel="next" accesskey="n" href="#sntp-keyfile">sntp keyfile</a>, 360280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-gap">sntp gap</a>, 361258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 362258945Sroberto<br> 363258945Sroberto</div> 364258945Sroberto 365258945Sroberto<h4 class="subsection">kod option (-K)</h4> 366258945Sroberto 367258945Sroberto<p><a name="index-sntp_002dkod-10"></a> 368258945SrobertoThis is the “kod history filename” option. 369280849ScyThis option takes a file argument <span class="file">file-name</span>. 370280849ScySpecifies the filename to be used for the persistent history of KoD 371280849Scyresponses received from servers. If the file does not exist, a 372280849Scywarning message will be displayed. The file will not be created. 373258945Sroberto<div class="node"> 374258945Sroberto<p><hr> 375280849Scy<a name="sntp-keyfile"></a>Next: <a rel="next" accesskey="n" href="#sntp-logfile">sntp logfile</a>, 376258945SrobertoPrevious: <a rel="previous" accesskey="p" href="#sntp-kod">sntp kod</a>, 377258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 378258945Sroberto<br> 379258945Sroberto</div> 380258945Sroberto 381280849Scy<h4 class="subsection">keyfile option (-k)</h4> 382280849Scy 383280849Scy<p><a name="index-sntp_002dkeyfile-11"></a> 384280849ScyThis is the “look in this file for the key specified with <span class="option">-a</span>” option. 385280849ScyThis option takes a file argument <span class="file">file-name</span>. 386280849ScyThis option specifies the keyfile. 387280849Scy<code>sntp</code> will search for the key specified with <span class="option">-a</span> 388280849Scy<span class="file">keyno</span> in this file. See <span class="command">ntp.keys(5)</span> for more 389280849Scyinformation. 390280849Scy<div class="node"> 391280849Scy<p><hr> 392280849Scy<a name="sntp-logfile"></a>Next: <a rel="next" accesskey="n" href="#sntp-steplimit">sntp steplimit</a>, 393280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-keyfile">sntp keyfile</a>, 394280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 395280849Scy<br> 396280849Scy</div> 397280849Scy 398258945Sroberto<h4 class="subsection">logfile option (-l)</h4> 399258945Sroberto 400280849Scy<p><a name="index-sntp_002dlogfile-12"></a> 401280849ScyThis is the “log to specified logfile” option. 402280849ScyThis option takes a file argument <span class="file">file-name</span>. 403280849ScyThis option causes the client to write log messages to the specified 404280849Scy<span class="file">logfile</span>. 405280849Scy<div class="node"> 406280849Scy<p><hr> 407280849Scy<a name="sntp-steplimit"></a>Next: <a rel="next" accesskey="n" href="#sntp-ntpversion">sntp ntpversion</a>, 408280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-logfile">sntp logfile</a>, 409280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 410280849Scy<br> 411280849Scy</div> 412258945Sroberto 413280849Scy<h4 class="subsection">steplimit option (-M)</h4> 414258945Sroberto 415280849Scy<p><a name="index-sntp_002dsteplimit-13"></a> 416280849ScyThis is the “adjustments less than <var>steplimit</var> msec will be slewed” option. 417280849ScyThis option takes a number argument. 418280849ScyIf the time adjustment is less than <span class="file">steplimit</span> milliseconds, 419280849Scyslew the amount using <span class="command">adjtime(2)</span>. Otherwise, step the 420280849Scycorrection using <span class="command">settimeofday(2)</span>. The default value is 0, 421280849Scywhich means all adjustments will be stepped. This is a feature, as 422280849Scydifferent situations demand different values. 423280849Scy<div class="node"> 424280849Scy<p><hr> 425280849Scy<a name="sntp-ntpversion"></a>Next: <a rel="next" accesskey="n" href="#sntp-usereservedport">sntp usereservedport</a>, 426280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-steplimit">sntp steplimit</a>, 427280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 428280849Scy<br> 429280849Scy</div> 430258945Sroberto 431280849Scy<h4 class="subsection">ntpversion option (-o)</h4> 432280849Scy 433280849Scy<p><a name="index-sntp_002dntpversion-14"></a> 434280849ScyThis is the “send <var>int</var> as our ntp protocol version” option. 435280849ScyThis option takes a number argument. 436280849ScyWhen sending requests to a remote server, tell them we are running 437280849ScyNTP protocol version <span class="file">ntpversion</span> . 438258945Sroberto<div class="node"> 439258945Sroberto<p><hr> 440280849Scy<a name="sntp-usereservedport"></a>Next: <a rel="next" accesskey="n" href="#sntp-timeout">sntp timeout</a>, 441280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-ntpversion">sntp ntpversion</a>, 442258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 443258945Sroberto<br> 444258945Sroberto</div> 445258945Sroberto 446280849Scy<h4 class="subsection">usereservedport option (-r)</h4> 447258945Sroberto 448280849Scy<p><a name="index-sntp_002dusereservedport-15"></a> 449280849ScyThis is the “use the ntp reserved port (port 123)” option. 450280849ScyUse port 123, which is reserved for NTP, for our network 451280849Scycommunications. 452280849Scy<div class="node"> 453280849Scy<p><hr> 454280849Scy<a name="sntp-timeout"></a>Next: <a rel="next" accesskey="n" href="#sntp-wait">sntp wait</a>, 455280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-usereservedport">sntp usereservedport</a>, 456280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 457280849Scy<br> 458280849Scy</div> 459258945Sroberto 460280849Scy<h4 class="subsection">timeout option (-t)</h4> 461280849Scy 462280849Scy<p><a name="index-sntp_002dtimeout-16"></a> 463280849ScyThis is the “the number of seconds to wait for responses” option. 464280849ScyThis option takes a number argument <span class="file">seconds</span>. 465280849ScyWhen waiting for a reply, <code>sntp</code> will wait the number 466280849Scyof seconds specified before giving up. The default should be 467280849Scymore than enough for a unicast response. If <code>sntp</code> is 468280849Scyonly waiting for a broadcast response a longer timeout is 469280849Scylikely needed. 470258945Sroberto<div class="node"> 471258945Sroberto<p><hr> 472280849Scy<a name="sntp-wait"></a>Next: <a rel="next" accesskey="n" href="#sntp-config">sntp config</a>, 473280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-timeout">sntp timeout</a>, 474258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 475258945Sroberto<br> 476258945Sroberto</div> 477258945Sroberto 478280849Scy<h4 class="subsection">wait option</h4> 479258945Sroberto 480280849Scy<p><a name="index-sntp_002dwait-17"></a> 481280849ScyThis is the “wait for pending replies (if not setting the time)” option. 482258945Sroberto 483280849Scy<p class="noindent">This option has some usage constraints. It: 484258945Sroberto <ul> 485280849Scy<li>can be disabled with –no-wait. 486280849Scy<li>It is enabled by default. 487258945Sroberto</ul> 488258945Sroberto 489280849Scy <p>If we are not setting the time, wait for all pending responses. 490280849Scy 491258945Sroberto<div class="node"> 492258945Sroberto<p><hr> 493280849Scy<a name="sntp-config"></a>Next: <a rel="next" accesskey="n" href="#sntp-exit-status">sntp exit status</a>, 494280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-wait">sntp wait</a>, 495258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 496258945Sroberto<br> 497258945Sroberto</div> 498258945Sroberto 499280849Scy<h4 class="subsection">presetting/configuring sntp</h4> 500258945Sroberto 501280849Scy<p>Any option that is not marked as <i>not presettable</i> may be preset by 502280849Scyloading 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 503280849Scythe options listed above in upper case and segmented with underscores. 504280849ScyThe <code>SNTP</code> variable will be tokenized and parsed like 505280849Scythe command line. The remaining variables are tested for existence and their 506280849Scyvalues are treated like option arguments. 507258945Sroberto 508280849Scy<p class="noindent"><code>libopts</code> will search in 2 places for configuration files: 509258945Sroberto <ul> 510280849Scy<li>$HOME 511280849Scy<li>$PWD 512258945Sroberto</ul> 513280849Scy The environment variables <code>HOME</code>, and <code>PWD</code> 514280849Scyare expanded and replaced when <span class="file">sntp</span> runs. 515280849ScyFor any of these that are plain files, they are simply processed. 516280849ScyFor any that are directories, then a file named <span class="file">.ntprc</span> is searched for 517280849Scywithin that directory and processed. 518258945Sroberto 519280849Scy <p>Configuration files may be in a wide variety of formats. 520280849ScyThe basic format is an option name followed by a value (argument) on the 521280849Scysame line. Values may be separated from the option name with a colon, 522280849Scyequal sign or simply white space. Values may be continued across multiple 523280849Scylines by escaping the newline with a backslash. 524258945Sroberto 525280849Scy <p>Multiple programs may also share the same initialization file. 526280849ScyCommon options are collected at the top, followed by program specific 527280849Scysegments. The segments are separated by lines like: 528280849Scy<pre class="example"> [SNTP] 529280849Scy</pre> 530280849Scy <p class="noindent">or by 531280849Scy<pre class="example"> <?program sntp> 532280849Scy</pre> 533280849Scy <p class="noindent">Do not mix these styles within one configuration file. 534280849Scy 535280849Scy <p>Compound values and carefully constructed string values may also be 536280849Scyspecified using XML syntax: 537280849Scy<pre class="example"> <option-name> 538280849Scy <sub-opt>...&lt;...&gt;...</sub-opt> 539280849Scy </option-name> 540280849Scy</pre> 541280849Scy <p class="noindent">yielding an <code>option-name.sub-opt</code> string value of 542280849Scy<pre class="example"> "...<...>..." 543280849Scy</pre> 544280849Scy <p><code>AutoOpts</code> does not track suboptions. You simply note that it is a 545280849Scyhierarchicly valued option. <code>AutoOpts</code> does provide a means for searching 546280849Scythe associated name/value pair list (see: optionFindValue). 547280849Scy 548280849Scy <p>The command line options relating to configuration and/or usage help are: 549280849Scy 550280849Scy<h5 class="subsubheading">version (-)</h5> 551280849Scy 552280849Scy<p>Print the program version to standard out, optionally with licensing 553280849Scyinformation, then exit 0. The optional argument specifies how much licensing 554280849Scydetail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. 555280849ScyOnly the first letter of the argument is examined: 556280849Scy 557280849Scy <dl> 558280849Scy<dt><span class="samp">version</span><dd>Only print the version. This is the default. 559280849Scy<br><dt><span class="samp">copyright</span><dd>Name the copyright usage licensing terms. 560280849Scy<br><dt><span class="samp">verbose</span><dd>Print the full copyright usage licensing terms. 561280849Scy</dl> 562280849Scy 563258945Sroberto<div class="node"> 564258945Sroberto<p><hr> 565280849Scy<a name="sntp-exit-status"></a>Next: <a rel="next" accesskey="n" href="#sntp-Usage">sntp Usage</a>, 566280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-config">sntp config</a>, 567258945SrobertoUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 568258945Sroberto<br> 569258945Sroberto</div> 570258945Sroberto 571280849Scy<h4 class="subsection">sntp exit status</h4> 572258945Sroberto 573280849Scy<p>One of the following exit values will be returned: 574280849Scy <dl> 575280849Scy<dt><span class="samp">0 (EXIT_SUCCESS)</span><dd>Successful program execution. 576280849Scy<br><dt><span class="samp">1 (EXIT_FAILURE)</span><dd>The operation failed or the command syntax was not valid. 577280849Scy<br><dt><span class="samp">66 (EX_NOINPUT)</span><dd>A specified configuration file could not be loaded. 578280849Scy<br><dt><span class="samp">70 (EX_SOFTWARE)</span><dd>libopts had an internal operational error. Please report 579280849Scyit to autogen-users@lists.sourceforge.net. Thank you. 580280849Scy</dl> 581280849Scy <div class="node"> 582280849Scy<p><hr> 583280849Scy<a name="sntp-Usage"></a>Next: <a rel="next" accesskey="n" href="#sntp-Authors">sntp Authors</a>, 584280849ScyPrevious: <a rel="previous" accesskey="p" href="#sntp-exit-status">sntp exit status</a>, 585280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 586280849Scy<br> 587280849Scy</div> 588258945Sroberto 589280849Scy<h4 class="subsection">sntp Usage</h4> 590280849Scy 591258945Sroberto<div class="node"> 592258945Sroberto<p><hr> 593280849Scy<a name="sntp-Authors"></a>Previous: <a rel="previous" accesskey="p" href="#sntp-Usage">sntp Usage</a>, 594280849ScyUp: <a rel="up" accesskey="u" href="#sntp-Invocation">sntp Invocation</a> 595280849Scy<br> 596280849Scy</div> 597280849Scy 598280849Scy<h4 class="subsection">sntp Authors</h4> 599280849Scy 600280849Scy<div class="node"> 601280849Scy<p><hr> 602258945Sroberto<a name="Usage"></a> 603258945Sroberto<br> 604258945Sroberto</div> 605258945Sroberto 606258945Sroberto<!-- node-name, next, previous, up --> 607258945Sroberto<h3 class="section">Usage</h3> 608258945Sroberto 609258945Sroberto<p>The simplest use of this program is as an unprivileged command to 610258945Srobertocheck the current time, offset, and error in the local clock. 611258945SrobertoFor example: 612258945Sroberto 613258945Sroberto<pre class="example"> sntp ntpserver.somewhere 614258945Sroberto</pre> 615258945Sroberto <p>With suitable privilege, it can be run as a command or in a 616258945Sroberto<code>crom</code> job to reset the local clock from a reliable server, like 617258945Srobertothe <code>ntpdate</code> and <code>rdate</code> commands. 618258945SrobertoFor example: 619258945Sroberto 620258945Sroberto<pre class="example"> sntp -a ntpserver.somewhere 621258945Sroberto</pre> 622258945Sroberto </body></html> 623258945Sroberto 624