<h3>Simple Network Time Protocol (SNTP) Client</h3>
<p>S is for snakeoil</p>
<p>Last update: <csobjformat="ShortTime"h="25"locale="00000409"region="0"t="DateTime"w="61">18:50</csobj> UTC <csobjformat="LongDate"h="25"locale="00000409"region="0"t="DateTime"w="246">Thursday, July 28, 2005</csobj></p>
<p>This program is a Simple Network Time Protocol (SNTP) client that can be used to query a Network TIme Protocol (NTP) server and display the time offset of the system clock relative to the server clock. Run as root it can correct the system clock to this offset as well. It can be run as an interactive command or from a script by a <tt>cron</tt> job. The program implements the SNTP protocol defined in RFC-2030, which is a subset of the NTP protocol defined in RFC-1305, but does not provide the sanity checks, access controls, security functions and mitigation algorithms as in the full NTP implementation.</p>
<p>While this program can do other things, including operation as a primitive server, some of these things are truly dangerous in a ubiquitous public time server network. A full disclosure is in the man page in the <tt>./sntp</tt> directory, but be truly advised RFC-2030 specifically <b>forbids</b> a SNTP client to operate as a server for other NTP or SNTP clients. If such operation is contemplated, do <b>not</b> allow access by clients on the public Internet.</p>
<p>By default, <tt>sntp</tt> writes the local date and time (i.e., not UTC) to the standard output in the format</p>
<p><tt>1996 Oct 15 20:17:25.123 + 4.567 +/- 0.089 secs</tt>,</p>
<p>where the <tt>+ 4.567 +/- 0.089 secs</tt> indicates the time offset and error bound of the system clock relative to the server clock.</p>
<p>If a NTP server <i>address</i> is explicitly specified, the program sends a single message to the server and waits up to <i>delay</i> seconds for a unicast server message. Otherwise, it sends no message and waits up to <i>delay</i> seconds for a broadcast server message.</p>
<h4>Options</h4>
<p><tt>sntp</tt> recognizes the following options:</p>
<dl>
<dt><tt>-h, --help</tt>
<dd>displays usage information.
<dt><tt>-v</tt>
<dd>writes diagnostic messages and a limited amount of tracing to standard error. The <tt>-v, -V</tt> and <tt>-W</tt> give increasing levels of detail.
<dt><tt>-r</tt>
<dd>steps the system clock to the correct time by the Unix <tt>settimeofday</tt> system call. Requires root priviledge.
<dt><tt>-a</tt>
<dd>slews the system clock to the correct time by the Unix <tt>adjtime</tt> system call. Requires root priviledge.
<dt><tt>-e <i>minerr</i></tt>
<dd>sets the minimum offset to <tt><i>minerr</i></tt> seconds. Measured offsets less than this are ignored. Acceptable values are from 0.001 to 1 with default 0.1 if unicast mode and 0.5 for broadcast mode.
<dt><tt>-E <i>maxerr</i></tt>
<dd>sets the maximum offset to <tt><i>maxerr</i></tt> seconds. Measured offsets greater than this are ignored. Acceptable values are from 1 to 60 with default 5.
<dt><tt>-P <i>prompt</i></tt>
<dd>sets the maximum automatic offset to <tt><i>maxerr</i></tt> seconds. Acceptable values are from 1 to 3600 or <tt>no</tt>, with default 30. If the program is being run interactively, measured offsets greater than this will prompt the user for confirmation. Specifying <tt>no</tt> will disable this and the correction will be made regardless.
<dt><tt>-c <i>count</i></tt>
<dd>sets the maximum number of NTP packets required to <i>count</i>. Acceptable values are from 1 to 25 in unicast mode and 5 to 25 in broadcast mode. The default is 5 in either mode.
<dt><tt>-d <i>delay</i></tt>
<dd>sets the maximum waiting time in broadcast mode to <i>delay</i> seconds. Acceptable values are from 1 to 3600, with default 15 in unicast mode and 300 in broadcast mode.
</dl>
<h4>Return Value</h4>
<p>The program returns an exit status of zero for success and non-zero otherwise.</p>
<h4>Author</h4>
<p><tt>sntp</tt> was developed by N.M. Maclaren of the University of Cambridge Computing Service.</p>