sntp.html revision 259065
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2 3<html> 4 5 <head> 6 <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> 7 <title>Simple Network Time Protocol (SNTP) Client</title> 8 <link href="scripts/style.css" type="text/css" rel="stylesheet"> 9 </head> 10 11 <body> 12 <h3>Simple Network Time Protocol (SNTP) Client</h3> 13 <img src="pic/dogsnake.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Alice's Adventures in Wonderland</i>, Lewis Carroll</a> 14 <p>S is for snakeoil</p> 15 <p>Last update: <csobj format="ShortTime" h="25" locale="00000409" region="0" t="DateTime" w="61">18:50</csobj> UTC <csobj format="LongDate" h="25" locale="00000409" region="0" t="DateTime" w="246">Thursday, July 28, 2005</csobj></p> 16 <br clear="left"> 17 <hr> 18 <h4>Synopsis</h4> 19 <tt>sntp [{-h --help -?}][{ -v -V -W }][{-r -a}][-P <i>prompt</i>][-e <i>minerr</i>][-E <i>maxerr</i>][-c <i>count</i>][-d <i>delay</i>][address(es)]</tt> 20 <h4>Description</h4> 21 <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> 22 <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> 23 <p>By default, <tt>sntp</tt> writes the local date and time (i.e., not UTC) to the standard output in the format</p> 24 <p><tt>1996 Oct 15 20:17:25.123 + 4.567 +/- 0.089 secs</tt>,</p> 25 <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> 26 <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> 27 <h4>Options</h4> 28 <p><tt>sntp</tt> recognizes the following options:</p> 29 <dl> 30 <dt><tt>-h, --help</tt> 31 <dd>displays usage information. 32 <dt><tt>-v</tt> 33 <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. 34 <dt><tt>-r</tt> 35 <dd>steps the system clock to the correct time by the Unix <tt>settimeofday</tt> system call. Requires root priviledge. 36 <dt><tt>-a</tt> 37 <dd>slews the system clock to the correct time by the Unix <tt>adjtime</tt> system call. Requires root priviledge. 38 <dt><tt>-e <i>minerr</i></tt> 39 <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. 40 <dt><tt>-E <i>maxerr</i></tt> 41 <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. 42 <dt><tt>-P <i>prompt</i></tt> 43 <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. 44 <dt><tt>-c <i>count</i></tt> 45 <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. 46 <dt><tt>-d <i>delay</i></tt> 47 <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. 48 </dl> 49 <h4>Return Value</h4> 50 <p>The program returns an exit status of zero for success and non-zero otherwise.</p> 51 <h4>Author</h4> 52 <p><tt>sntp</tt> was developed by N.M. Maclaren of the University of Cambridge Computing Service.</p> 53 <hr> 54 <script type="text/javascript" language="javascript" src="scripts/footer.txt"></script> 55 </body> 56 57</html>