1344884Scy<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2344884Scy<html> 3344884Scy<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> 4258945Sroberto<head> 5344884Scy<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 6344884Scy<title>Sntp User’s Manual</title> 7344884Scy 8344884Scy<meta name="description" content="Sntp User’s Manual"> 9344884Scy<meta name="keywords" content="Sntp User’s Manual"> 10344884Scy<meta name="resource-type" content="document"> 11344884Scy<meta name="distribution" content="global"> 12344884Scy<meta name="Generator" content="makeinfo"> 13344884Scy<link href="#Top" rel="start" title="Top"> 14344884Scy<link href="dir.html#Top" rel="up" title="(dir)"> 15344884Scy<style type="text/css"> 16344884Scy<!-- 17344884Scya.summary-letter {text-decoration: none} 18344884Scyblockquote.indentedblock {margin-right: 0em} 19344884Scyblockquote.smallindentedblock {margin-right: 0em; font-size: smaller} 20344884Scyblockquote.smallquotation {font-size: smaller} 21344884Scydiv.display {margin-left: 3.2em} 22344884Scydiv.example {margin-left: 3.2em} 23344884Scydiv.lisp {margin-left: 3.2em} 24344884Scydiv.smalldisplay {margin-left: 3.2em} 25344884Scydiv.smallexample {margin-left: 3.2em} 26344884Scydiv.smalllisp {margin-left: 3.2em} 27344884Scykbd {font-style: oblique} 28344884Scypre.display {font-family: inherit} 29344884Scypre.format {font-family: inherit} 30344884Scypre.menu-comment {font-family: serif} 31344884Scypre.menu-preformatted {font-family: serif} 32344884Scypre.smalldisplay {font-family: inherit; font-size: smaller} 33344884Scypre.smallexample {font-size: smaller} 34344884Scypre.smallformat {font-family: inherit; font-size: smaller} 35344884Scypre.smalllisp {font-size: smaller} 36344884Scyspan.nolinebreak {white-space: nowrap} 37344884Scyspan.roman {font-family: initial; font-weight: normal} 38344884Scyspan.sansserif {font-family: sans-serif; font-weight: normal} 39344884Scyul.no-bullet {list-style: none} 40344884Scy--> 41344884Scy</style> 42344884Scy 43344884Scy 44258945Sroberto</head> 45344884Scy 46344884Scy<body lang="en"> 47344884Scy<h1 class="settitle" align="center">Sntp User’s Manual</h1> 48344884Scy 49344884Scy 50344884Scy 51344884Scy 52344884Scy 53344884Scy<a name="Top"></a> 54344884Scy<div class="header"> 55344884Scy<p> 56344884ScyNext: <a href="#sntp-Description" accesskey="n" rel="next">sntp Description</a>, Previous: <a href="dir.html#Top" accesskey="p" rel="prev">(dir)</a>, Up: <a href="dir.html#Top" accesskey="u" rel="up">(dir)</a> </p> 57258945Sroberto</div> 58344884Scy<a name="Simple-Network-Time-Protocol-User-Manual"></a> 59344884Scy<h1 class="top">Simple Network Time Protocol User Manual</h1> 60258945Sroberto 61344884Scy<p>This document describes the use of the NTP Project’s <code>sntp</code> program, 62258945Srobertothat can be used to query a Network Time Protocol (NTP) server and 63258945Srobertodisplay the time offset of the system clock relative to the server 64258945Srobertoclock. Run as root, it can correct the system clock to this offset as 65258945Srobertowell. It can be run as an interactive command or from a cron job. 66344884Scy</p> 67362716Scy<p>This document applies to version 4.2.8p15 of <code>sntp</code>. 68344884Scy</p> 69344884Scy<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4 70258945SrobertoIETF specification. 71344884Scy</p> 72344884Scy<a name="SEC_Overview"></a> 73344884Scy<h2 class="shortcontents-heading">Short Table of Contents</h2> 74258945Sroberto 75344884Scy<div class="shortcontents"> 76344884Scy<ul class="no-bullet"> 77344884Scy<li><a name="stoc-Description" href="#toc-Description">1 Description</a></li> 78258945Sroberto</ul> 79258945Sroberto</div> 80258945Sroberto 81258945Sroberto 82344884Scy<table class="menu" border="0" cellspacing="0"> 83344884Scy<tr><td align="left" valign="top">• <a href="#sntp-Description" accesskey="1">sntp Description</a>:</td><td> </td><td align="left" valign="top">Description 84344884Scy</td></tr> 85344884Scy<tr><td align="left" valign="top">• <a href="#sntp-Invocation" accesskey="2">sntp Invocation</a>:</td><td> </td><td align="left" valign="top">Invoking sntp 86344884Scy</td></tr> 87344884Scy<tr><td align="left" valign="top">• <a href="#Usage" accesskey="3">Usage</a>:</td><td> </td><td align="left" valign="top">Usage 88344884Scy</td></tr> 89344884Scy</table> 90344884Scy 91344884Scy<hr> 92258945Sroberto<a name="sntp-Description"></a> 93344884Scy<div class="header"> 94344884Scy<p> 95344884ScyNext: <a href="#sntp-Invocation" accesskey="n" rel="next">sntp Invocation</a>, Up: <a href="#Top" accesskey="u" rel="up">Top</a> </p> 96258945Sroberto</div> 97344884Scy<a name="Description"></a> 98344884Scy<h2 class="chapter">1 Description</h2> 99258945Sroberto 100258945Sroberto<p>By default, <code>sntp</code> writes the local data and time (i.e., not UTC) to the 101258945Srobertostandard output in the format: 102344884Scy</p> 103344884Scy<div class="example"> 104344884Scy<pre class="example">1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 secs 105344884Scy</pre></div> 106258945Sroberto 107344884Scy<p>where 108280849ScyYYYY-MM-DD HH:MM:SS.SUBSEC is the local date and time, 109280849Scy(+0800) is the local timezone adjustment (so we would add 8 hours and 0 minutes to convert the reported local time to UTC), 110280849Scyand 111280849Scythe +4.567 +/- 0.089 secs indicates the time offset and 112258945Srobertoerror bound of the system clock relative to the server clock. 113344884Scy</p> 114344884Scy<table class="menu" border="0" cellspacing="0"> 115344884Scy<tr><td align="left" valign="top">• <a href="#sntp-Invocation" accesskey="1">sntp Invocation</a>:</td><td> </td><td align="left" valign="top"> 116344884Scy</td></tr> 117344884Scy<tr><td align="left" valign="top">• <a href="#Usage" accesskey="2">Usage</a>:</td><td> </td><td align="left" valign="top"> 118344884Scy</td></tr> 119344884Scy</table> 120258945Sroberto 121344884Scy<hr> 122258945Sroberto<a name="sntp-Invocation"></a> 123344884Scy<div class="header"> 124344884Scy<p> 125344884ScyNext: <a href="#Usage" accesskey="n" rel="next">Usage</a>, Previous: <a href="#sntp-Description" accesskey="p" rel="prev">sntp Description</a>, Up: <a href="#sntp-Description" accesskey="u" rel="up">sntp Description</a> </p> 126258945Sroberto</div> 127344884Scy<a name="Invoking-sntp"></a> 128344884Scy<h3 class="section">1.1 Invoking sntp</h3> 129344884Scy<a name="index-sntp"></a> 130344884Scy<a name="index-standard-Simple-Network-Time-Protocol-client-program"></a> 131258945Sroberto 132258945Sroberto 133280849Scy 134344884Scy<p><code>sntp</code> 135280849Scycan be used as an SNTP client to query a NTP or SNTP server and either display 136344884Scythe time or set the local system’s time (given suitable privilege). It can be 137280849Scyrun as an interactive command or from a 138258945Sroberto<code>cron</code> 139258945Srobertojob. 140344884Scy</p> 141344884Scy<p>NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) 142258945Srobertoare defined and described by RFC 5905. 143344884Scy</p> 144258945Sroberto 145344884Scy<p>The default is to write the estimated correct local date and time (i.e. not 146280849ScyUTC) to the standard output in a format like: 147344884Scy</p> 148344884Scy<p><code>'1996-10-15 20:17:25.123 (+0800) +4.567 +/- 0.089 [host] IP sN'</code> 149344884Scy</p> 150344884Scy<p>where the 151280849Scy<code>'(+0800)'</code> 152280849Scymeans that to get to UTC from the reported local time one must 153280849Scyadd 8 hours and 0 minutes, 154280849Scythe 155280849Scy<code>'+4.567'</code> 156280849Scyindicates the local clock is 4.567 seconds behind the correct time 157344884Scy(so 4.567 seconds must be added to the local clock to get it to be correct). 158280849ScyNote that the number of decimals printed for this value will change 159344884Scybased on the reported precision of the server. 160280849Scy<code>'+/- 0.089'</code> 161280849Scyis the reported 162280849Scy<em>synchronization</em> <em>distance</em> 163344884Scy(in seconds), which represents the maximum error due to all causes. 164280849ScyIf the server does not report valid data needed to calculate the 165280849Scysynchronization distance, this will be reported as 166344884Scy<code>'+/- ?'</code>. 167280849ScyIf the 168280849Scy<em>host</em> 169280849Scyis different from the 170280849Scy<em>IP</em>, 171344884Scyboth will be displayed. 172344884ScyOtherwise, only the 173280849Scy<em>IP</em> 174344884Scyis displayed. 175280849ScyFinally, the 176280849Scy<em>stratum</em> 177282408Scyof the host is reported 178282408Scyand the leap indicator is decoded and displayed. 179344884Scy</p> 180344884Scy<p>This section was generated by <strong>AutoGen</strong>, 181344884Scyusing the <code>agtexi-cmd</code> template and the option descriptions for the <code>sntp</code> program. 182280849ScyThis software is released under the NTP license, <http://ntp.org/license>. 183344884Scy</p> 184344884Scy<table class="menu" border="0" cellspacing="0"> 185344884Scy<tr><td align="left" valign="top">• <a href="#sntp-usage" accesskey="1">sntp usage</a>:</td><td> </td><td align="left" valign="top">sntp help/usage (<samp>--help</samp>) 186344884Scy</td></tr> 187344884Scy<tr><td align="left" valign="top">• <a href="#sntp-ipv4" accesskey="2">sntp ipv4</a>:</td><td> </td><td align="left" valign="top">ipv4 option (-4) 188344884Scy</td></tr> 189344884Scy<tr><td align="left" valign="top">• <a href="#sntp-ipv6" accesskey="3">sntp ipv6</a>:</td><td> </td><td align="left" valign="top">ipv6 option (-6) 190344884Scy</td></tr> 191344884Scy<tr><td align="left" valign="top">• <a href="#sntp-authentication" accesskey="4">sntp authentication</a>:</td><td> </td><td align="left" valign="top">authentication option (-a) 192344884Scy</td></tr> 193344884Scy<tr><td align="left" valign="top">• <a href="#sntp-broadcast" accesskey="5">sntp broadcast</a>:</td><td> </td><td align="left" valign="top">broadcast option (-b) 194344884Scy</td></tr> 195344884Scy<tr><td align="left" valign="top">• <a href="#sntp-concurrent" accesskey="6">sntp concurrent</a>:</td><td> </td><td align="left" valign="top">concurrent option (-c) 196344884Scy</td></tr> 197344884Scy<tr><td align="left" valign="top">• <a href="#sntp-gap" accesskey="7">sntp gap</a>:</td><td> </td><td align="left" valign="top">gap option (-g) 198344884Scy</td></tr> 199344884Scy<tr><td align="left" valign="top">• <a href="#sntp-kod" accesskey="8">sntp kod</a>:</td><td> </td><td align="left" valign="top">kod option (-K) 200344884Scy</td></tr> 201344884Scy<tr><td align="left" valign="top">• <a href="#sntp-keyfile" accesskey="9">sntp keyfile</a>:</td><td> </td><td align="left" valign="top">keyfile option (-k) 202344884Scy</td></tr> 203344884Scy<tr><td align="left" valign="top">• <a href="#sntp-logfile">sntp logfile</a>:</td><td> </td><td align="left" valign="top">logfile option (-l) 204344884Scy</td></tr> 205344884Scy<tr><td align="left" valign="top">• <a href="#sntp-steplimit">sntp steplimit</a>:</td><td> </td><td align="left" valign="top">steplimit option (-M) 206344884Scy</td></tr> 207344884Scy<tr><td align="left" valign="top">• <a href="#sntp-ntpversion">sntp ntpversion</a>:</td><td> </td><td align="left" valign="top">ntpversion option (-o) 208344884Scy</td></tr> 209344884Scy<tr><td align="left" valign="top">• <a href="#sntp-usereservedport">sntp usereservedport</a>:</td><td> </td><td align="left" valign="top">usereservedport option (-r) 210344884Scy</td></tr> 211344884Scy<tr><td align="left" valign="top">• <a href="#sntp-timeout">sntp timeout</a>:</td><td> </td><td align="left" valign="top">timeout option (-t) 212344884Scy</td></tr> 213344884Scy<tr><td align="left" valign="top">• <a href="#sntp-wait">sntp wait</a>:</td><td> </td><td align="left" valign="top">wait option 214344884Scy</td></tr> 215344884Scy<tr><td align="left" valign="top">• <a href="#sntp-config">sntp config</a>:</td><td> </td><td align="left" valign="top">presetting/configuring sntp 216344884Scy</td></tr> 217344884Scy<tr><td align="left" valign="top">• <a href="#sntp-exit-status">sntp exit status</a>:</td><td> </td><td align="left" valign="top">exit status 218344884Scy</td></tr> 219344884Scy<tr><td align="left" valign="top">• <a href="#sntp-Usage">sntp Usage</a>:</td><td> </td><td align="left" valign="top">Usage 220344884Scy</td></tr> 221344884Scy<tr><td align="left" valign="top">• <a href="#sntp-Authors">sntp Authors</a>:</td><td> </td><td align="left" valign="top">Authors 222344884Scy</td></tr> 223344884Scy</table> 224258945Sroberto 225344884Scy<hr> 226344884Scy<a name="sntp-usage"></a> 227344884Scy<div class="header"> 228344884Scy<p> 229344884ScyNext: <a href="#sntp-ipv4" accesskey="n" rel="next">sntp ipv4</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 230258945Sroberto</div> 231344884Scy<a name="sntp-help_002fusage-_0028_002d_002dhelp_0029"></a> 232344884Scy<h4 class="subsection">1.1.1 sntp help/usage (<samp>--help</samp>)</h4> 233344884Scy<a name="index-sntp-help"></a> 234258945Sroberto 235344884Scy<p>This is the automatically generated usage text for sntp. 236344884Scy</p> 237344884Scy<p>The text printed is the same whether selected with the <code>help</code> option 238344884Scy(<samp>--help</samp>) or the <code>more-help</code> option (<samp>--more-help</samp>). <code>more-help</code> will print 239344884Scythe usage text by passing it through a pager program. 240280849Scy<code>more-help</code> is disabled on platforms without a working 241280849Scy<code>fork(2)</code> function. The <code>PAGER</code> environment variable is 242344884Scyused to select the program, defaulting to <samp>more</samp>. Both will exit 243280849Scywith a status code of 0. 244344884Scy</p> 245344884Scy<div class="example"> 246362716Scy<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p15 247338530SdelphijUsage: sntp [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \ 248258945Sroberto [ hostname-or-IP ...] 249258945Sroberto Flg Arg Option-Name Description 250258945Sroberto -4 no ipv4 Force IPv4 DNS name resolution 251338530Sdelphij - prohibits the option 'ipv6' 252258945Sroberto -6 no ipv6 Force IPv6 DNS name resolution 253338530Sdelphij - prohibits the option 'ipv4' 254338530Sdelphij -a Num authentication Enable authentication with the key auth-keynumber 255280849Scy -b Str broadcast Listen to the address specified for broadcast time sync 256258945Sroberto - may appear multiple times 257280849Scy -c Str concurrent Concurrently query all IPs returned for host-name 258280849Scy - may appear multiple times 259280849Scy -d no debug-level Increase debug verbosity level 260280849Scy - may appear multiple times 261338530Sdelphij -D Num set-debug-level Set the debug verbosity level 262280849Scy - may appear multiple times 263280849Scy -g Num gap The gap (in milliseconds) between time requests 264280849Scy -K Fil kod KoD history filename 265338530Sdelphij -k Fil keyfile Look in this file for the key specified with -a 266280849Scy -l Fil logfile Log to specified logfile 267338530Sdelphij -M Num steplimit Adjustments less than steplimit msec will be slewed 268338530Sdelphij - it must be in the range: 269280849Scy greater than or equal to 0 270338530Sdelphij -o Num ntpversion Send int as our NTP protocol version 271338530Sdelphij - it must be in the range: 272280849Scy 0 to 7 273280849Scy -r no usereservedport Use the NTP Reserved Port (port 123) 274338530Sdelphij -S no step OK to 'step' the time with settimeofday(2) 275338530Sdelphij -s no slew OK to 'slew' the time with adjtime(2) 276338530Sdelphij -t Num timeout The number of seconds to wait for responses 277280849Scy no wait Wait for pending replies (if not setting the time) 278338530Sdelphij - disabled as '--no-wait' 279280849Scy - enabled by default 280338530Sdelphij opt version output version information and exit 281338530Sdelphij -? no help display extended usage information and exit 282338530Sdelphij -! no more-help extended usage information passed thru pager 283338530Sdelphij -> opt save-opts save the option state to a config file 284338530Sdelphij -< Str load-opts load options from a config file 285338530Sdelphij - disabled as '--no-load-opts' 286280849Scy - may appear multiple times 287258945Sroberto 288258945SrobertoOptions are specified by doubled hyphens and their name or by a single 289258945Srobertohyphen and the flag character. 290258945Sroberto 291258945Sroberto 292258945SrobertoThe following option preset mechanisms are supported: 293258945Sroberto - reading file $HOME/.ntprc 294258945Sroberto - reading file ./.ntprc 295258945Sroberto - examining environment variables named SNTP_* 296258945Sroberto 297338530SdelphijPlease send bug reports to: <http://bugs.ntp.org, bugs@ntp.org> 298344884Scy</pre></div> 299344884Scy 300344884Scy<hr> 301344884Scy<a name="sntp-ipv4"></a> 302344884Scy<div class="header"> 303344884Scy<p> 304344884ScyNext: <a href="#sntp-ipv6" accesskey="n" rel="next">sntp ipv6</a>, Previous: <a href="#sntp-usage" accesskey="p" rel="prev">sntp usage</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 305258945Sroberto</div> 306344884Scy<a name="ipv4-option-_0028_002d4_0029"></a> 307344884Scy<h4 class="subsection">1.1.2 ipv4 option (-4)</h4> 308344884Scy<a name="index-sntp_002dipv4"></a> 309258945Sroberto 310344884Scy<p>This is the “force ipv4 dns name resolution” option. 311344884Scy</p> 312344884Scy<p>This option has some usage constraints. It: 313344884Scy</p><ul> 314344884Scy<li> must not appear in combination with any of the following options: 315344884Scyipv6. 316344884Scy</li></ul> 317258945Sroberto 318344884Scy<p>Force DNS resolution of the following host names on the command line 319344884Scyto the IPv4 namespace. 320344884Scy</p><hr> 321344884Scy<a name="sntp-ipv6"></a> 322344884Scy<div class="header"> 323344884Scy<p> 324344884ScyNext: <a href="#sntp-authentication" accesskey="n" rel="next">sntp authentication</a>, Previous: <a href="#sntp-ipv4" accesskey="p" rel="prev">sntp ipv4</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 325258945Sroberto</div> 326344884Scy<a name="ipv6-option-_0028_002d6_0029"></a> 327344884Scy<h4 class="subsection">1.1.3 ipv6 option (-6)</h4> 328344884Scy<a name="index-sntp_002dipv6"></a> 329258945Sroberto 330344884Scy<p>This is the “force ipv6 dns name resolution” option. 331344884Scy</p> 332344884Scy<p>This option has some usage constraints. It: 333344884Scy</p><ul> 334344884Scy<li> must not appear in combination with any of the following options: 335344884Scyipv4. 336344884Scy</li></ul> 337258945Sroberto 338344884Scy<p>Force DNS resolution of the following host names on the command line 339344884Scyto the IPv6 namespace. 340344884Scy</p><hr> 341344884Scy<a name="sntp-authentication"></a> 342344884Scy<div class="header"> 343344884Scy<p> 344344884ScyNext: <a href="#sntp-broadcast" accesskey="n" rel="next">sntp broadcast</a>, Previous: <a href="#sntp-ipv6" accesskey="p" rel="prev">sntp ipv6</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 345258945Sroberto</div> 346344884Scy<a name="authentication-option-_0028_002da_0029"></a> 347344884Scy<h4 class="subsection">1.1.4 authentication option (-a)</h4> 348344884Scy<a name="index-sntp_002dauthentication"></a> 349258945Sroberto 350344884Scy<p>This is the “enable authentication with the key <var>auth-keynumber</var>” option. 351344884ScyThis option takes a number argument <samp>auth-keynumber</samp>. 352344884ScyEnable authentication using the key specified in this option’s 353344884Scyargument. The argument of this option is the <samp>keyid</samp>, a 354344884Scynumber specified in the <samp>keyfile</samp> as this key’s identifier. 355344884ScySee the <samp>keyfile</samp> option (<samp>-k</samp>) for more details. 356344884Scy</p><hr> 357344884Scy<a name="sntp-broadcast"></a> 358344884Scy<div class="header"> 359344884Scy<p> 360344884ScyNext: <a href="#sntp-concurrent" accesskey="n" rel="next">sntp concurrent</a>, Previous: <a href="#sntp-authentication" accesskey="p" rel="prev">sntp authentication</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 361258945Sroberto</div> 362344884Scy<a name="broadcast-option-_0028_002db_0029"></a> 363344884Scy<h4 class="subsection">1.1.5 broadcast option (-b)</h4> 364344884Scy<a name="index-sntp_002dbroadcast"></a> 365258945Sroberto 366344884Scy<p>This is the “listen to the address specified for broadcast time sync” option. 367344884ScyThis option takes a string argument <samp>broadcast-address</samp>. 368344884Scy</p> 369344884Scy<p>This option has some usage constraints. It: 370344884Scy</p><ul> 371344884Scy<li> may appear an unlimited number of times. 372344884Scy</li></ul> 373258945Sroberto 374344884Scy<p>If specified <code>sntp</code> will listen to the specified address 375280849Scyfor NTP broadcasts. The default maximum wait time 376344884Scycan (and probably should) be modified with <samp>-t</samp>. 377344884Scy</p><hr> 378344884Scy<a name="sntp-concurrent"></a> 379344884Scy<div class="header"> 380344884Scy<p> 381344884ScyNext: <a href="#sntp-gap" accesskey="n" rel="next">sntp gap</a>, Previous: <a href="#sntp-broadcast" accesskey="p" rel="prev">sntp broadcast</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 382258945Sroberto</div> 383344884Scy<a name="concurrent-option-_0028_002dc_0029"></a> 384344884Scy<h4 class="subsection">1.1.6 concurrent option (-c)</h4> 385344884Scy<a name="index-sntp_002dconcurrent"></a> 386258945Sroberto 387344884Scy<p>This is the “concurrently query all ips returned for host-name” option. 388344884ScyThis option takes a string argument <samp>host-name</samp>. 389344884Scy</p> 390344884Scy<p>This option has some usage constraints. It: 391344884Scy</p><ul> 392344884Scy<li> may appear an unlimited number of times. 393344884Scy</li></ul> 394258945Sroberto 395344884Scy<p>Requests from an NTP "client" to a "server" should never be sent 396280849Scymore rapidly than one every 2 seconds. By default, any IPs returned 397280849Scyas part of a DNS lookup are assumed to be for a single instance of 398280849Scy<code>ntpd</code>, and therefore <code>sntp</code> will send queries to these IPs 399280849Scyone after another, with a 2-second gap in between each query. 400344884Scy</p> 401344884Scy<p>The <samp>-c</samp> or <samp>--concurrent</samp> flag says that any IPs 402280849Scyreturned for the DNS lookup of the supplied host-name are on 403344884Scydifferent machines, so we can send concurrent queries. 404344884Scy</p><hr> 405344884Scy<a name="sntp-gap"></a> 406344884Scy<div class="header"> 407344884Scy<p> 408344884ScyNext: <a href="#sntp-kod" accesskey="n" rel="next">sntp kod</a>, Previous: <a href="#sntp-concurrent" accesskey="p" rel="prev">sntp concurrent</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 409258945Sroberto</div> 410344884Scy<a name="gap-option-_0028_002dg_0029"></a> 411344884Scy<h4 class="subsection">1.1.7 gap option (-g)</h4> 412344884Scy<a name="index-sntp_002dgap"></a> 413258945Sroberto 414344884Scy<p>This is the “the gap (in milliseconds) between time requests” option. 415344884ScyThis option takes a number argument <samp>milliseconds</samp>. 416344884ScySince we’re only going to use the first valid response we get and 417280849Scythere is benefit to specifying a good number of servers to query, 418280849Scyseparate the queries we send out by the specified number of 419344884Scymilliseconds. 420344884Scy</p><hr> 421344884Scy<a name="sntp-kod"></a> 422344884Scy<div class="header"> 423344884Scy<p> 424344884ScyNext: <a href="#sntp-keyfile" accesskey="n" rel="next">sntp keyfile</a>, Previous: <a href="#sntp-gap" accesskey="p" rel="prev">sntp gap</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 425258945Sroberto</div> 426344884Scy<a name="kod-option-_0028_002dK_0029"></a> 427344884Scy<h4 class="subsection">1.1.8 kod option (-K)</h4> 428344884Scy<a name="index-sntp_002dkod"></a> 429258945Sroberto 430344884Scy<p>This is the “kod history filename” option. 431344884ScyThis option takes a file argument <samp>file-name</samp>. 432280849ScySpecifies the filename to be used for the persistent history of KoD 433280849Scyresponses received from servers. If the file does not exist, a 434344884Scywarning message will be displayed. The file will not be created. 435344884Scy</p><hr> 436344884Scy<a name="sntp-keyfile"></a> 437344884Scy<div class="header"> 438344884Scy<p> 439344884ScyNext: <a href="#sntp-logfile" accesskey="n" rel="next">sntp logfile</a>, Previous: <a href="#sntp-kod" accesskey="p" rel="prev">sntp kod</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 440258945Sroberto</div> 441344884Scy<a name="keyfile-option-_0028_002dk_0029"></a> 442344884Scy<h4 class="subsection">1.1.9 keyfile option (-k)</h4> 443344884Scy<a name="index-sntp_002dkeyfile"></a> 444258945Sroberto 445344884Scy<p>This is the “look in this file for the key specified with <samp>-a</samp>” option. 446344884ScyThis option takes a file argument <samp>file-name</samp>. 447344884ScyThis option specifies the keyfile. 448344884Scy<code>sntp</code> will search for the key specified with <samp>-a</samp> 449344884Scy<samp>keyno</samp> in this file. See <code>ntp.keys(5)</code> for more 450344884Scyinformation. 451344884Scy</p><hr> 452344884Scy<a name="sntp-logfile"></a> 453344884Scy<div class="header"> 454344884Scy<p> 455344884ScyNext: <a href="#sntp-steplimit" accesskey="n" rel="next">sntp steplimit</a>, Previous: <a href="#sntp-keyfile" accesskey="p" rel="prev">sntp keyfile</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 456280849Scy</div> 457344884Scy<a name="logfile-option-_0028_002dl_0029"></a> 458344884Scy<h4 class="subsection">1.1.10 logfile option (-l)</h4> 459344884Scy<a name="index-sntp_002dlogfile"></a> 460280849Scy 461344884Scy<p>This is the “log to specified logfile” option. 462344884ScyThis option takes a file argument <samp>file-name</samp>. 463280849ScyThis option causes the client to write log messages to the specified 464344884Scy<samp>logfile</samp>. 465344884Scy</p><hr> 466344884Scy<a name="sntp-steplimit"></a> 467344884Scy<div class="header"> 468344884Scy<p> 469344884ScyNext: <a href="#sntp-ntpversion" accesskey="n" rel="next">sntp ntpversion</a>, Previous: <a href="#sntp-logfile" accesskey="p" rel="prev">sntp logfile</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 470280849Scy</div> 471344884Scy<a name="steplimit-option-_0028_002dM_0029"></a> 472344884Scy<h4 class="subsection">1.1.11 steplimit option (-M)</h4> 473344884Scy<a name="index-sntp_002dsteplimit"></a> 474258945Sroberto 475344884Scy<p>This is the “adjustments less than <var>steplimit</var> msec will be slewed” option. 476344884ScyThis option takes a number argument. 477344884ScyIf the time adjustment is less than <samp>steplimit</samp> milliseconds, 478344884Scyslew the amount using <code>adjtime(2)</code>. Otherwise, step the 479344884Scycorrection using <code>settimeofday(2)</code>. The default value is 0, 480280849Scywhich means all adjustments will be stepped. This is a feature, as 481344884Scydifferent situations demand different values. 482344884Scy</p><hr> 483344884Scy<a name="sntp-ntpversion"></a> 484344884Scy<div class="header"> 485344884Scy<p> 486344884ScyNext: <a href="#sntp-usereservedport" accesskey="n" rel="next">sntp usereservedport</a>, Previous: <a href="#sntp-steplimit" accesskey="p" rel="prev">sntp steplimit</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 487280849Scy</div> 488344884Scy<a name="ntpversion-option-_0028_002do_0029"></a> 489344884Scy<h4 class="subsection">1.1.12 ntpversion option (-o)</h4> 490344884Scy<a name="index-sntp_002dntpversion"></a> 491258945Sroberto 492344884Scy<p>This is the “send <var>int</var> as our ntp protocol version” option. 493344884ScyThis option takes a number argument. 494280849ScyWhen sending requests to a remote server, tell them we are running 495344884ScyNTP protocol version <samp>ntpversion</samp> . 496344884Scy</p><hr> 497344884Scy<a name="sntp-usereservedport"></a> 498344884Scy<div class="header"> 499344884Scy<p> 500344884ScyNext: <a href="#sntp-timeout" accesskey="n" rel="next">sntp timeout</a>, Previous: <a href="#sntp-ntpversion" accesskey="p" rel="prev">sntp ntpversion</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 501258945Sroberto</div> 502344884Scy<a name="usereservedport-option-_0028_002dr_0029"></a> 503344884Scy<h4 class="subsection">1.1.13 usereservedport option (-r)</h4> 504344884Scy<a name="index-sntp_002dusereservedport"></a> 505258945Sroberto 506344884Scy<p>This is the “use the ntp reserved port (port 123)” option. 507280849ScyUse port 123, which is reserved for NTP, for our network 508344884Scycommunications. 509344884Scy</p><hr> 510344884Scy<a name="sntp-timeout"></a> 511344884Scy<div class="header"> 512344884Scy<p> 513344884ScyNext: <a href="#sntp-wait" accesskey="n" rel="next">sntp wait</a>, Previous: <a href="#sntp-usereservedport" accesskey="p" rel="prev">sntp usereservedport</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 514280849Scy</div> 515344884Scy<a name="timeout-option-_0028_002dt_0029"></a> 516344884Scy<h4 class="subsection">1.1.14 timeout option (-t)</h4> 517344884Scy<a name="index-sntp_002dtimeout"></a> 518258945Sroberto 519344884Scy<p>This is the “the number of seconds to wait for responses” option. 520344884ScyThis option takes a number argument <samp>seconds</samp>. 521280849ScyWhen waiting for a reply, <code>sntp</code> will wait the number 522280849Scyof seconds specified before giving up. The default should be 523280849Scymore than enough for a unicast response. If <code>sntp</code> is 524280849Scyonly waiting for a broadcast response a longer timeout is 525344884Scylikely needed. 526344884Scy</p><hr> 527344884Scy<a name="sntp-wait"></a> 528344884Scy<div class="header"> 529344884Scy<p> 530344884ScyNext: <a href="#sntp-config" accesskey="n" rel="next">sntp config</a>, Previous: <a href="#sntp-timeout" accesskey="p" rel="prev">sntp timeout</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 531258945Sroberto</div> 532344884Scy<a name="wait-option"></a> 533344884Scy<h4 class="subsection">1.1.15 wait option</h4> 534344884Scy<a name="index-sntp_002dwait"></a> 535258945Sroberto 536344884Scy<p>This is the “wait for pending replies (if not setting the time)” option. 537344884Scy</p> 538344884Scy<p>This option has some usage constraints. It: 539344884Scy</p><ul> 540344884Scy<li> can be disabled with –no-wait. 541344884Scy</li><li> It is enabled by default. 542344884Scy</li></ul> 543258945Sroberto 544344884Scy<p>If we are not setting the time, wait for all pending responses. 545344884Scy</p> 546258945Sroberto 547344884Scy<hr> 548344884Scy<a name="sntp-config"></a> 549344884Scy<div class="header"> 550344884Scy<p> 551344884ScyNext: <a href="#sntp-exit-status" accesskey="n" rel="next">sntp exit status</a>, Previous: <a href="#sntp-wait" accesskey="p" rel="prev">sntp wait</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 552258945Sroberto</div> 553344884Scy<a name="presetting_002fconfiguring-sntp"></a> 554344884Scy<h4 class="subsection">1.1.16 presetting/configuring sntp</h4> 555258945Sroberto 556280849Scy<p>Any option that is not marked as <i>not presettable</i> may be preset by 557344884Scyloading 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 558344884Scythe options listed above in upper case and segmented with underscores. 559280849ScyThe <code>SNTP</code> variable will be tokenized and parsed like 560280849Scythe command line. The remaining variables are tested for existence and their 561280849Scyvalues are treated like option arguments. 562344884Scy</p> 563258945Sroberto 564344884Scy<p><code>libopts</code> will search in 2 places for configuration files: 565344884Scy</p><ul> 566344884Scy<li> $HOME 567344884Scy</li><li> $PWD 568344884Scy</li></ul> 569344884Scy<p>The environment variables <code>HOME</code>, and <code>PWD</code> 570344884Scyare expanded and replaced when <samp>sntp</samp> runs. 571344884ScyFor any of these that are plain files, they are simply processed. 572344884ScyFor any that are directories, then a file named <samp>.ntprc</samp> is searched for 573280849Scywithin that directory and processed. 574344884Scy</p> 575344884Scy<p>Configuration files may be in a wide variety of formats. 576280849ScyThe basic format is an option name followed by a value (argument) on the 577280849Scysame line. Values may be separated from the option name with a colon, 578280849Scyequal sign or simply white space. Values may be continued across multiple 579280849Scylines by escaping the newline with a backslash. 580344884Scy</p> 581344884Scy<p>Multiple programs may also share the same initialization file. 582280849ScyCommon options are collected at the top, followed by program specific 583280849Scysegments. The segments are separated by lines like: 584344884Scy</p><div class="example"> 585344884Scy<pre class="example">[SNTP] 586344884Scy</pre></div> 587344884Scy<p>or by 588344884Scy</p><div class="example"> 589344884Scy<pre class="example"><?program sntp> 590344884Scy</pre></div> 591344884Scy<p>Do not mix these styles within one configuration file. 592344884Scy</p> 593344884Scy<p>Compound values and carefully constructed string values may also be 594280849Scyspecified using XML syntax: 595344884Scy</p><div class="example"> 596344884Scy<pre class="example"><option-name> 597344884Scy <sub-opt>...&lt;...&gt;...</sub-opt> 598344884Scy</option-name> 599344884Scy</pre></div> 600344884Scy<p>yielding an <code>option-name.sub-opt</code> string value of 601344884Scy</p><div class="example"> 602344884Scy<pre class="example">"...<...>..." 603344884Scy</pre></div> 604344884Scy<p><code>AutoOpts</code> does not track suboptions. You simply note that it is a 605280849Scyhierarchicly valued option. <code>AutoOpts</code> does provide a means for searching 606280849Scythe associated name/value pair list (see: optionFindValue). 607344884Scy</p> 608344884Scy<p>The command line options relating to configuration and/or usage help are: 609344884Scy</p> 610344884Scy<a name="version-_0028_002d_0029"></a> 611344884Scy<h4 class="subsubheading">version (-)</h4> 612280849Scy 613280849Scy<p>Print the program version to standard out, optionally with licensing 614280849Scyinformation, then exit 0. The optional argument specifies how much licensing 615344884Scydetail to provide. The default is to print just the version. The licensing infomation may be selected with an option argument. 616280849ScyOnly the first letter of the argument is examined: 617344884Scy</p> 618344884Scy<dl compact="compact"> 619344884Scy<dt>‘<samp>version</samp>’</dt> 620344884Scy<dd><p>Only print the version. This is the default. 621344884Scy</p></dd> 622344884Scy<dt>‘<samp>copyright</samp>’</dt> 623344884Scy<dd><p>Name the copyright usage licensing terms. 624344884Scy</p></dd> 625344884Scy<dt>‘<samp>verbose</samp>’</dt> 626344884Scy<dd><p>Print the full copyright usage licensing terms. 627344884Scy</p></dd> 628280849Scy</dl> 629280849Scy 630344884Scy<hr> 631344884Scy<a name="sntp-exit-status"></a> 632344884Scy<div class="header"> 633344884Scy<p> 634344884ScyNext: <a href="#sntp-Usage" accesskey="n" rel="next">sntp Usage</a>, Previous: <a href="#sntp-config" accesskey="p" rel="prev">sntp config</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 635258945Sroberto</div> 636344884Scy<a name="sntp-exit-status-1"></a> 637344884Scy<h4 class="subsection">1.1.17 sntp exit status</h4> 638258945Sroberto 639280849Scy<p>One of the following exit values will be returned: 640344884Scy</p><dl compact="compact"> 641344884Scy<dt>‘<samp>0 (EXIT_SUCCESS)</samp>’</dt> 642344884Scy<dd><p>Successful program execution. 643344884Scy</p></dd> 644344884Scy<dt>‘<samp>1 (EXIT_FAILURE)</samp>’</dt> 645344884Scy<dd><p>The operation failed or the command syntax was not valid. 646344884Scy</p></dd> 647344884Scy<dt>‘<samp>66 (EX_NOINPUT)</samp>’</dt> 648344884Scy<dd><p>A specified configuration file could not be loaded. 649344884Scy</p></dd> 650344884Scy<dt>‘<samp>70 (EX_SOFTWARE)</samp>’</dt> 651344884Scy<dd><p>libopts had an internal operational error. Please report 652344884Scyit to autogen-users@lists.sourceforge.net. Thank you. 653344884Scy</p></dd> 654280849Scy</dl> 655344884Scy<hr> 656344884Scy<a name="sntp-Usage"></a> 657344884Scy<div class="header"> 658344884Scy<p> 659344884ScyNext: <a href="#sntp-Authors" accesskey="n" rel="next">sntp Authors</a>, Previous: <a href="#sntp-exit-status" accesskey="p" rel="prev">sntp exit status</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 660280849Scy</div> 661344884Scy<a name="sntp-Usage-1"></a> 662344884Scy<h4 class="subsection">1.1.18 sntp Usage</h4> 663344884Scy<hr> 664344884Scy<a name="sntp-Authors"></a> 665344884Scy<div class="header"> 666344884Scy<p> 667344884ScyPrevious: <a href="#sntp-Usage" accesskey="p" rel="prev">sntp Usage</a>, Up: <a href="#sntp-Invocation" accesskey="u" rel="up">sntp Invocation</a> </p> 668280849Scy</div> 669344884Scy<a name="sntp-Authors-1"></a> 670344884Scy<h4 class="subsection">1.1.19 sntp Authors</h4> 671280849Scy 672344884Scy<hr> 673258945Sroberto<a name="Usage"></a> 674344884Scy<div class="header"> 675344884Scy<p> 676344884ScyPrevious: <a href="#sntp-Invocation" accesskey="p" rel="prev">sntp Invocation</a>, Up: <a href="#sntp-Description" accesskey="u" rel="up">sntp Description</a> </p> 677258945Sroberto</div> 678344884Scy<a name="Usage-1"></a> 679344884Scy<h3 class="section">1.2 Usage</h3> 680258945Sroberto 681258945Sroberto<p>The simplest use of this program is as an unprivileged command to 682344884Scycheck the current time, offset, and error in the local clock. 683258945SrobertoFor example: 684344884Scy</p> 685344884Scy<div class="example"> 686344884Scy<pre class="example">sntp ntpserver.somewhere 687344884Scy</pre></div> 688258945Sroberto 689344884Scy<p>With suitable privilege, it can be run as a command or in a 690258945Sroberto<code>crom</code> job to reset the local clock from a reliable server, like 691344884Scythe <code>ntpdate</code> and <code>rdate</code> commands. 692258945SrobertoFor example: 693344884Scy</p> 694344884Scy<div class="example"> 695344884Scy<pre class="example">sntp -a ntpserver.somewhere 696344884Scy</pre></div> 697344884Scy<hr> 698258945Sroberto 699258945Sroberto 700344884Scy 701344884Scy</body> 702344884Scy</html> 703