sntp.html   [plain text]


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title><tt>sntp</tt> - Simple Network Time Protocol (SNTP) Client</title>
		<link href="scripts/style.css" type="text/css" rel="stylesheet">
	</head>

	<body>
		<h3><tt>sntp</tt> - Simple Network Time Protocol (SNTP) Client</h3>
		<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>
		<p>S is for snakeoil.</p>
		<p>Last update: <csobj format="ShortTime" h="25" locale="00000409" region="0" t="DateTime" w="61">16:31</csobj> UTC <csobj format="LongDate" h="25" locale="00000409" region="0" t="DateTime" w="289">Wednesday, March 12, 2008</csobj></p>
		<br clear="left">
		<hr>
		<h4>Synopsis</h4>
		<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>
		<h4>Description</h4>
		<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-4330, which is a subset of the NTP&nbsp;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>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&nbsp;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>
		<hr>
		<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
	</body>

</html>