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