1316722Sdelphij.Dd March 21 2017 2275970Scy.Dt SNTP 1sntpmdoc User Commands 3275970Scy.Os 4275970Scy.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) 5275970Scy.\" 6316722Sdelphij.\" It has been AutoGen-ed March 21, 2017 at 10:36:52 AM by AutoGen 5.18.5 7275970Scy.\" From the definitions sntp-opts.def 8275970Scy.\" and the template file agmdoc-cmd.tpl 9275970Scy.Sh NAME 10275970Scy.Nm sntp 11275970Scy.Nd standard Simple Network Time Protocol client program 12275970Scy.Sh SYNOPSIS 13275970Scy.Nm 14275970Scy.\" Mixture of short (flag) options and long options 15275970Scy.Op Fl flags 16275970Scy.Op Fl flag Op Ar value 17275970Scy.Op Fl \-option\-name Ns Oo Oo Ns "=| " Oc Ns Ar value Oc 18275970Scy[ hostname\-or\-IP ...] 19275970Scy.Pp 20275970Scy.Sh DESCRIPTION 21275970Scy.Nm 22275970Scycan be used as an SNTP client to query a NTP or SNTP server and either display 23275970Scythe time or set the local system's time (given suitable privilege). It can be 24275970Scyrun as an interactive command or from a 25275970Scy.Ic cron 26275970Scyjob. 27275970ScyNTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) 28275970Scyare defined and described by RFC 5905. 29275970Scy.Pp 30275970ScyThe default is to write the estimated correct local date and time (i.e. not 31275970ScyUTC) to the standard output in a format like: 32275970Scy.Ic "'1996\-10\-15 20:17:25.123 (+0800) +4.567 +/\- 0.089 [host] IP sN'" 33275970Scywhere the 34275970Scy.Ic "'(+0800)'" 35275970Scymeans that to get to UTC from the reported local time one must 36275970Scyadd 8 hours and 0 minutes, 37275970Scythe 38275970Scy.Ic "'+4.567'" 39275970Scyindicates the local clock is 4.567 seconds behind the correct time 40275970Scy(so 4.567 seconds must be added to the local clock to get it to be correct). 41275970ScyNote that the number of decimals printed for this value will change 42275970Scybased on the reported precision of the server. 43275970Scy.Ic "'+/\- 0.089'" 44275970Scyis the reported 45275970Scy.Em synchronization distance 46275970Scy(in seconds), which represents the maximum error due to all causes. 47275970ScyIf the server does not report valid data needed to calculate the 48275970Scysynchronization distance, this will be reported as 49275970Scy.Ic "'+/\- ?'" . 50275970ScyIf the 51275970Scy.Em host 52275970Scyis different from the 53275970Scy.Em IP , 54275970Scyboth will be displayed. 55275970ScyOtherwise, only the 56275970Scy.Em IP 57275970Scyis displayed. 58275970ScyFinally, the 59275970Scy.Em stratum 60282408Scyof the host is reported 61282408Scyand the leap indicator is decoded and displayed. 62275970Scy.Sh "OPTIONS" 63275970Scy.Bl -tag 64275970Scy.It Fl 4 , Fl \-ipv4 65275970ScyForce IPv4 DNS name resolution. 66275970ScyThis option must not appear in combination with any of the following options: 67275970Scyipv6. 68275970Scy.sp 69275970ScyForce DNS resolution of the following host names on the command line 70275970Scyto the IPv4 namespace. 71275970Scy.It Fl 6 , Fl \-ipv6 72275970ScyForce IPv6 DNS name resolution. 73275970ScyThis option must not appear in combination with any of the following options: 74275970Scyipv4. 75275970Scy.sp 76275970ScyForce DNS resolution of the following host names on the command line 77275970Scyto the IPv6 namespace. 78275970Scy.It Fl a Ar auth\-keynumber , Fl \-authentication Ns = Ns Ar auth\-keynumber 79275970ScyEnable authentication with the key \fBauth\-keynumber\fP. 80275970ScyThis option takes an integer number as its argument. 81275970Scy.sp 82275970ScyEnable authentication using the key specified in this option's 83275970Scyargument. The argument of this option is the \fBkeyid\fP, a 84275970Scynumber specified in the \fBkeyfile\fP as this key's identifier. 85275970ScySee the \fBkeyfile\fP option (\fB\-k\fP) for more details. 86275970Scy.It Fl b Ar broadcast\-address , Fl \-broadcast Ns = Ns Ar broadcast\-address 87275970ScyListen to the address specified for broadcast time sync. 88275970ScyThis option may appear an unlimited number of times. 89275970Scy.sp 90275970ScyIf specified \fBsntp\fP will listen to the specified address 91275970Scyfor NTP broadcasts. The default maximum wait time 92275970Scycan (and probably should) be modified with \fB\-t\fP. 93275970Scy.It Fl c Ar host\-name , Fl \-concurrent Ns = Ns Ar host\-name 94275970ScyConcurrently query all IPs returned for host\-name. 95275970ScyThis option may appear an unlimited number of times. 96275970Scy.sp 97275970ScyRequests from an NTP "client" to a "server" should never be sent 98275970Scymore rapidly than one every 2 seconds. By default, any IPs returned 99275970Scyas part of a DNS lookup are assumed to be for a single instance of 100275970Scy\fBntpd\fP, and therefore \fBsntp\fP will send queries to these IPs 101275970Scyone after another, with a 2\-second gap in between each query. 102275970Scy.sp 103275970ScyThe \fB\-c\fP or \fB\-\-concurrent\fP flag says that any IPs 104275970Scyreturned for the DNS lookup of the supplied host\-name are on 105275970Scydifferent machines, so we can send concurrent queries. 106275970Scy.It Fl d , Fl \-debug\-level 107275970ScyIncrease debug verbosity level. 108275970ScyThis option may appear an unlimited number of times. 109275970Scy.sp 110275970Scy.It Fl D Ar number , Fl \-set\-debug\-level Ns = Ns Ar number 111275970ScySet the debug verbosity level. 112275970ScyThis option may appear an unlimited number of times. 113275970ScyThis option takes an integer number as its argument. 114275970Scy.sp 115275970Scy.It Fl g Ar milliseconds , Fl \-gap Ns = Ns Ar milliseconds 116275970ScyThe gap (in milliseconds) between time requests. 117275970ScyThis option takes an integer number as its argument. 118275970ScyThe default 119275970Scy.Ar milliseconds 120275970Scyfor this option is: 121275970Scy.ti +4 122275970Scy 50 123275970Scy.sp 124275970ScySince we're only going to use the first valid response we get and 125275970Scythere is benefit to specifying a good number of servers to query, 126275970Scyseparate the queries we send out by the specified number of 127275970Scymilliseconds. 128275970Scy.It Fl K Ar file\-name , Fl \-kod Ns = Ns Ar file\-name 129275970ScyKoD history filename. 130275970ScyThe default 131275970Scy.Ar file\-name 132275970Scyfor this option is: 133275970Scy.ti +4 134275970Scy /var/db/ntp\-kod 135275970Scy.sp 136275970ScySpecifies the filename to be used for the persistent history of KoD 137275970Scyresponses received from servers. If the file does not exist, a 138275970Scywarning message will be displayed. The file will not be created. 139275970Scy.It Fl k Ar file\-name , Fl \-keyfile Ns = Ns Ar file\-name 140275970ScyLook in this file for the key specified with \fB\-a\fP. 141275970Scy.sp 142275970ScyThis option specifies the keyfile. 143275970Scy\fBsntp\fP will search for the key specified with \fB\-a\fP 144275970Scy\fIkeyno\fP in this file. See \fBntp.keys(5)\fP for more 145275970Scyinformation. 146275970Scy.It Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name 147275970ScyLog to specified logfile. 148275970Scy.sp 149275970ScyThis option causes the client to write log messages to the specified 150275970Scy\fIlogfile\fP. 151275970Scy.It Fl M Ar number , Fl \-steplimit Ns = Ns Ar number 152275970ScyAdjustments less than \fBsteplimit\fP msec will be slewed. 153275970ScyThis option takes an integer number as its argument. 154275970ScyThe value of 155275970Scy.Ar number 156275970Scyis constrained to being: 157275970Scy.in +4 158275970Scy.nf 159275970Scy.na 160275970Scygreater than or equal to 0 161275970Scy.fi 162275970Scy.in -4 163275970Scy.sp 164275970ScyIf the time adjustment is less than \fIsteplimit\fP milliseconds, 165275970Scyslew the amount using \fBadjtime(2)\fP. Otherwise, step the 166280849Scycorrection using \fBsettimeofday(2)\fP. The default value is 0, 167280849Scywhich means all adjustments will be stepped. This is a feature, as 168280849Scydifferent situations demand different values. 169275970Scy.It Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number 170275970ScySend \fBint\fP as our NTP protocol version. 171275970ScyThis option takes an integer number as its argument. 172275970ScyThe value of 173275970Scy.Ar number 174275970Scyis constrained to being: 175275970Scy.in +4 176275970Scy.nf 177275970Scy.na 178275970Scyin the range 0 through 7 179275970Scy.fi 180275970Scy.in -4 181275970ScyThe default 182275970Scy.Ar number 183275970Scyfor this option is: 184275970Scy.ti +4 185275970Scy 4 186275970Scy.sp 187275970ScyWhen sending requests to a remote server, tell them we are running 188275970ScyNTP protocol version \fIntpversion\fP . 189275970Scy.It Fl r , Fl \-usereservedport 190275970ScyUse the NTP Reserved Port (port 123). 191275970Scy.sp 192275970ScyUse port 123, which is reserved for NTP, for our network 193275970Scycommunications. 194275970Scy.It Fl S , Fl \-step 195275970ScyOK to 'step' the time with \fBsettimeofday(2)\fP. 196275970Scy.sp 197275970Scy.It Fl s , Fl \-slew 198275970ScyOK to 'slew' the time with \fBadjtime(2)\fP. 199275970Scy.sp 200275970Scy.It Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds 201275970ScyThe number of seconds to wait for responses. 202275970ScyThis option takes an integer number as its argument. 203275970ScyThe default 204275970Scy.Ar seconds 205275970Scyfor this option is: 206275970Scy.ti +4 207275970Scy 5 208275970Scy.sp 209275970ScyWhen waiting for a reply, \fBsntp\fP will wait the number 210275970Scyof seconds specified before giving up. The default should be 211275970Scymore than enough for a unicast response. If \fBsntp\fP is 212275970Scyonly waiting for a broadcast response a longer timeout is 213275970Scylikely needed. 214310419Sdelphij.It Fl \-wait , Fl \-no\-wait 215275970ScyWait for pending replies (if not setting the time). 216275970ScyThe \fIno\-wait\fP form will disable the option. 217275970ScyThis option is enabled by default. 218275970Scy.sp 219275970ScyIf we are not setting the time, wait for all pending responses. 220275970Scy.It Fl \&? , Fl \-help 221275970ScyDisplay usage information and exit. 222275970Scy.It Fl \&! , Fl \-more\-help 223275970ScyPass the extended usage information through a pager. 224275970Scy.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc 225275970ScySave the option state to \fIcfgfile\fP. The default is the \fIlast\fP 226275970Scyconfiguration file listed in the \fBOPTION PRESETS\fP section, below. 227275970ScyThe command will exit after updating the config file. 228275970Scy.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts 229275970ScyLoad options from \fIcfgfile\fP. 230275970ScyThe \fIno\-load\-opts\fP form will disable the loading 231275970Scyof earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early, 232275970Scyout of order. 233275970Scy.It Fl \-version Op Brq Ar v|c|n 234275970ScyOutput version of program and exit. The default mode is `v', a simple 235275970Scyversion. The `c' mode will print copyright information and `n' will 236275970Scyprint the full copyright notice. 237275970Scy.El 238275970Scy.Sh "OPTION PRESETS" 239275970ScyAny option that is not marked as \fInot presettable\fP may be preset 240275970Scyby loading values from configuration ("RC" or ".INI") file(s) and values from 241275970Scyenvironment variables named: 242275970Scy.nf 243275970Scy \fBSNTP_<option\-name>\fP or \fBSNTP\fP 244275970Scy.fi 245275970Scy.ad 246275970ScyThe environmental presets take precedence (are processed later than) 247275970Scythe configuration files. 248275970ScyThe \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". 249275970ScyIf any of these are directories, then the file \fI.ntprc\fP 250275970Scyis searched for within those directories. 251275970Scy.Sh USAGE 252275970Scy.Bl -tag -width indent 253275970Scy.It Li "sntp ntpserver.somewhere" 254275970Scyis the simplest use of this program 255275970Scyand can be run as an unprivileged command 256275970Scyto check the current time and error in the local clock. 257280849Scy.It Li "sntp \-Ss \-M 128 ntpserver.somewhere" 258275970ScyWith suitable privilege, 259275970Scyrun as a command 260275970Scyor from a 261275970Scy.Xr cron 8 262275970Scyjob, 263280849Scy.Ic "sntp \-Ss \-M 128 ntpserver.somewhere" 264280849Scywill request the time from the server, 265280849Scyand if that server reports that it is synchronized 266280849Scythen if the offset adjustment is less than 128 milliseconds 267280849Scythe correction will be slewed, 268280849Scyand if the correction is more than 128 milliseconds 269280849Scythe correction will be stepped. 270280849Scy.It Li "sntp \-S ntpserver.somewhere" 271280849ScyWith suitable privilege, 272280849Scyrun as a command 273280849Scyor from a 274280849Scy.Xr cron 8 275280849Scyjob, 276280849Scy.Ic "sntp \-S ntpserver.somewhere" 277280849Scywill set (step) the local clock from a synchronized specified server, 278275970Scylike the (deprecated) 279275970Scy.Xr ntpdate 1ntpdatemdoc , 280275970Scyor 281275970Scy.Xr rdate 8 282275970Scycommands. 283275970Scy.El 284275970Scy.Sh "ENVIRONMENT" 285275970ScySee \fBOPTION PRESETS\fP for configuration environment variables. 286275970Scy.Sh "FILES" 287275970ScySee \fBOPTION PRESETS\fP for configuration files. 288275970Scy.Sh "EXIT STATUS" 289275970ScyOne of the following exit values will be returned: 290275970Scy.Bl -tag 291275970Scy.It 0 " (EXIT_SUCCESS)" 292275970ScySuccessful program execution. 293275970Scy.It 1 " (EXIT_FAILURE)" 294275970ScyThe operation failed or the command syntax was not valid. 295275970Scy.It 66 " (EX_NOINPUT)" 296275970ScyA specified configuration file could not be loaded. 297275970Scy.It 70 " (EX_SOFTWARE)" 298275970Scylibopts had an internal operational error. Please report 299275970Scyit to autogen\-users@lists.sourceforge.net. Thank you. 300275970Scy.El 301275970Scy.Sh AUTHORS 302275970Scy.An "Johannes Maximilian Kuehn" 303275970Scy.An "Harlan Stenn" 304275970Scy.An "Dave Hart" 305275970Scy.Sh "COPYRIGHT" 306316722SdelphijCopyright (C) 1992\-2017 The University of Delaware and Network Time Foundation all rights reserved. 307275970ScyThis program is released under the terms of the NTP license, <http://ntp.org/license>. 308275970Scy.Sh "BUGS" 309275970ScyPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org 310275970Scy.Sh "NOTES" 311275970ScyThis manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP 312275970Scyoption definitions. 313