2 .Dt SNTP 1sntpmdoc User Commands
4 .\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
6 .\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5
7 .\" From the definitions sntp-opts.def
8 .\" and the template file agmdoc-cmd.tpl
11 .Nd standard Simple Network Time Protocol client program
14 .\" Mixture of short (flag) options and long options
16 .Op Fl flag Op Ar value
17 .Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc
18 [ hostname\-or\-IP ...]
22 can be used as an SNTP client to query a NTP or SNTP server and either display
23 the time or set the local system's time (given suitable privilege). It can be
24 run as an interactive command or from a
27 NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol)
28 are defined and described by RFC 5905.
30 The default is to write the estimated correct local date and time (i.e. not
31 UTC) to the standard output in a format like:
32 .Ic "'1996\-10\-15 20:17:25.123 (+0800) +4.567 +/\- 0.089 [host] IP sN'"
35 means that to get to UTC from the reported local time one must
36 add 8 hours and 0 minutes,
39 indicates the local clock is 4.567 seconds behind the correct time
40 (so 4.567 seconds must be added to the local clock to get it to be correct).
41 Note that the number of decimals printed for this value will change
42 based on the reported precision of the server.
45 .Em synchronization distance
46 (in seconds), which represents the maximum error due to all causes.
47 If the server does not report valid data needed to calculate the
48 synchronization distance, this will be reported as
54 both will be displayed.
60 of the host is reported
61 and the leap indicator is decoded and displayed.
65 Force IPv4 DNS name resolution.
66 This option must not appear in combination with any of the following options:
69 Force DNS resolution of the following host names on the command line
70 to the IPv4 namespace.
72 Force IPv6 DNS name resolution.
73 This option must not appear in combination with any of the following options:
76 Force DNS resolution of the following host names on the command line
77 to the IPv6 namespace.
78 .It Fl a Ar auth\-keynumber , Fl \-authentication Ns = Ns Ar auth\-keynumber
79 Enable authentication with the key \fBauth\-keynumber\fP.
80 This option takes an integer number as its argument.
82 Enable authentication using the key specified in this option's
83 argument. The argument of this option is the \fBkeyid\fP, a
84 number specified in the \fBkeyfile\fP as this key's identifier.
85 See the \fBkeyfile\fP option (\fB\-k\fP) for more details.
86 .It Fl b Ar broadcast\-address , Fl \-broadcast Ns = Ns Ar broadcast\-address
87 Listen to the address specified for broadcast time sync.
88 This option may appear an unlimited number of times.
90 If specified \fBsntp\fP will listen to the specified address
91 for NTP broadcasts. The default maximum wait time
92 can (and probably should) be modified with \fB\-t\fP.
93 .It Fl c Ar host\-name , Fl \-concurrent Ns = Ns Ar host\-name
94 Concurrently query all IPs returned for host\-name.
95 This option may appear an unlimited number of times.
97 Requests from an NTP "client" to a "server" should never be sent
98 more rapidly than one every 2 seconds. By default, any IPs returned
99 as part of a DNS lookup are assumed to be for a single instance of
100 \fBntpd\fP, and therefore \fBsntp\fP will send queries to these IPs
101 one after another, with a 2\-second gap in between each query.
103 The \fB\-c\fP or \fB\-\-concurrent\fP flag says that any IPs
104 returned for the DNS lookup of the supplied host\-name are on
105 different machines, so we can send concurrent queries.
106 .It Fl d , Fl \-debug\-level
107 Increase debug verbosity level.
108 This option may appear an unlimited number of times.
110 .It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number
111 Set the debug verbosity level.
112 This option may appear an unlimited number of times.
113 This option takes an integer number as its argument.
115 .It Fl g Ar milliseconds , Fl \-gap Ns = Ns Ar milliseconds
116 The gap (in milliseconds) between time requests.
117 This option takes an integer number as its argument.
124 Since we're only going to use the first valid response we get and
125 there is benefit to specifying a good number of servers to query,
126 separate the queries we send out by the specified number of
128 .It Fl K Ar file\-name , Fl \-kod Ns = Ns Ar file\-name
129 KoD history filename.
136 Specifies the filename to be used for the persistent history of KoD
137 responses received from servers. If the file does not exist, a
138 warning message will be displayed. The file will not be created.
139 .It Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name
140 Look in this file for the key specified with \fB\-a\fP.
142 This option specifies the keyfile.
143 \fBsntp\fP will search for the key specified with \fB\-a\fP
144 \fIkeyno\fP in this file. See \fBntp.keys(5)\fP for more
146 .It Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name
147 Log to specified logfile.
149 This option causes the client to write log messages to the specified
151 .It Fl M Ar number , Fl \-steplimit Ns = Ns Ar number
152 Adjustments less than \fBsteplimit\fP msec will be slewed.
153 This option takes an integer number as its argument.
156 is constrained to being:
160 greater than or equal to 0
164 If the time adjustment is less than \fIsteplimit\fP milliseconds,
165 slew the amount using \fBadjtime(2)\fP. Otherwise, step the
166 correction using \fBsettimeofday(2)\fP. The default value is 0,
167 which means all adjustments will be stepped. This is a feature, as
168 different situations demand different values.
169 .It Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number
170 Send \fBint\fP as our NTP protocol version.
171 This option takes an integer number as its argument.
174 is constrained to being:
178 in the range 0 through 7
187 When sending requests to a remote server, tell them we are running
188 NTP protocol version \fIntpversion\fP .
189 .It Fl r , Fl \-usereservedport
190 Use the NTP Reserved Port (port 123).
192 Use port 123, which is reserved for NTP, for our network
195 OK to 'step' the time with \fBsettimeofday(2)\fP.
198 OK to 'slew' the time with \fBadjtime(2)\fP.
200 .It Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds
201 The number of seconds to wait for responses.
202 This option takes an integer number as its argument.
209 When waiting for a reply, \fBsntp\fP will wait the number
210 of seconds specified before giving up. The default should be
211 more than enough for a unicast response. If \fBsntp\fP is
212 only waiting for a broadcast response a longer timeout is
214 .It Fl \-wait , " Fl \-no\-wait"
215 Wait for pending replies (if not setting the time).
216 The \fIno\-wait\fP form will disable the option.
217 This option is enabled by default.
219 If we are not setting the time, wait for all pending responses.
220 .It Fl \&? , Fl \-help
221 Display usage information and exit.
222 .It Fl \&! , Fl \-more\-help
223 Pass the extended usage information through a pager.
224 .It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc
225 Save the option state to \fIcfgfile\fP. The default is the \fIlast\fP
226 configuration file listed in the \fBOPTION PRESETS\fP section, below.
227 The command will exit after updating the config file.
228 .It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts
229 Load options from \fIcfgfile\fP.
230 The \fIno\-load\-opts\fP form will disable the loading
231 of earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early,
233 .It Fl \-version Op Brq Ar v|c|n
234 Output version of program and exit. The default mode is `v', a simple
235 version. The `c' mode will print copyright information and `n' will
236 print the full copyright notice.
239 Any option that is not marked as \fInot presettable\fP may be preset
240 by loading values from configuration ("RC" or ".INI") file(s) and values from
241 environment variables named:
243 \fBSNTP_<option\-name>\fP or \fBSNTP\fP
246 The environmental presets take precedence (are processed later than)
247 the configuration files.
248 The \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP".
249 If any of these are directories, then the file \fI.ntprc\fP
250 is searched for within those directories.
252 .Bl -tag -width indent
253 .It Li "sntp ntpserver.somewhere"
254 is the simplest use of this program
255 and can be run as an unprivileged command
256 to check the current time and error in the local clock.
257 .It Li "sntp \-Ss \-M 128 ntpserver.somewhere"
258 With suitable privilege,
263 .Ic "sntp \-Ss \-M 128 ntpserver.somewhere"
264 will request the time from the server,
265 and if that server reports that it is synchronized
266 then if the offset adjustment is less than 128 milliseconds
267 the correction will be slewed,
268 and if the correction is more than 128 milliseconds
269 the correction will be stepped.
270 .It Li "sntp \-S ntpserver.somewhere"
271 With suitable privilege,
276 .Ic "sntp \-S ntpserver.somewhere"
277 will set (step) the local clock from a synchronized specified server,
278 like the (deprecated)
279 .Xr ntpdate 1ntpdatemdoc ,
285 See \fBOPTION PRESETS\fP for configuration environment variables.
287 See \fBOPTION PRESETS\fP for configuration files.
289 One of the following exit values will be returned:
291 .It 0 " (EXIT_SUCCESS)"
292 Successful program execution.
293 .It 1 " (EXIT_FAILURE)"
294 The operation failed or the command syntax was not valid.
295 .It 66 " (EX_NOINPUT)"
296 A specified configuration file could not be loaded.
297 .It 70 " (EX_SOFTWARE)"
298 libopts had an internal operational error. Please report
299 it to autogen\-users@lists.sourceforge.net. Thank you.
302 .An "Johannes Maximilian Kuehn"
306 Copyright (C) 1992\-2015 The University of Delaware and Network Time Foundation all rights reserved.
307 This program is released under the terms of the NTP license, <http://ntp.org/license>.
309 Please send bug reports to: http://bugs.ntp.org, bugs@ntp.org
311 This manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP