1362716Scy.Dd June 23 2020 2275970Scy.Dt SNTP 1sntpmdoc User Commands 3275970Scy.Os 4275970Scy.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc) 5275970Scy.\" 6362716Scy.\" It has been AutoGen-ed June 23, 2020 at 02:19:35 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. 141330106SdelphijThe default 142330106Sdelphij.Ar file\-name 143330106Sdelphijfor this option is: 144330106Sdelphij.ti +4 145330106Sdelphij /etc/ntp.keys 146275970Scy.sp 147275970ScyThis option specifies the keyfile. 148275970Scy\fBsntp\fP will search for the key specified with \fB\-a\fP 149275970Scy\fIkeyno\fP in this file. See \fBntp.keys(5)\fP for more 150275970Scyinformation. 151275970Scy.It Fl l Ar file\-name , Fl \-logfile Ns = Ns Ar file\-name 152275970ScyLog to specified logfile. 153275970Scy.sp 154275970ScyThis option causes the client to write log messages to the specified 155275970Scy\fIlogfile\fP. 156275970Scy.It Fl M Ar number , Fl \-steplimit Ns = Ns Ar number 157275970ScyAdjustments less than \fBsteplimit\fP msec will be slewed. 158275970ScyThis option takes an integer number as its argument. 159275970ScyThe value of 160275970Scy.Ar number 161275970Scyis constrained to being: 162275970Scy.in +4 163275970Scy.nf 164275970Scy.na 165275970Scygreater than or equal to 0 166275970Scy.fi 167275970Scy.in -4 168275970Scy.sp 169275970ScyIf the time adjustment is less than \fIsteplimit\fP milliseconds, 170275970Scyslew the amount using \fBadjtime(2)\fP. Otherwise, step the 171280849Scycorrection using \fBsettimeofday(2)\fP. The default value is 0, 172280849Scywhich means all adjustments will be stepped. This is a feature, as 173280849Scydifferent situations demand different values. 174275970Scy.It Fl o Ar number , Fl \-ntpversion Ns = Ns Ar number 175275970ScySend \fBint\fP as our NTP protocol version. 176275970ScyThis option takes an integer number as its argument. 177275970ScyThe value of 178275970Scy.Ar number 179275970Scyis constrained to being: 180275970Scy.in +4 181275970Scy.nf 182275970Scy.na 183275970Scyin the range 0 through 7 184275970Scy.fi 185275970Scy.in -4 186275970ScyThe default 187275970Scy.Ar number 188275970Scyfor this option is: 189275970Scy.ti +4 190275970Scy 4 191275970Scy.sp 192275970ScyWhen sending requests to a remote server, tell them we are running 193275970ScyNTP protocol version \fIntpversion\fP . 194275970Scy.It Fl r , Fl \-usereservedport 195275970ScyUse the NTP Reserved Port (port 123). 196275970Scy.sp 197275970ScyUse port 123, which is reserved for NTP, for our network 198275970Scycommunications. 199275970Scy.It Fl S , Fl \-step 200275970ScyOK to 'step' the time with \fBsettimeofday(2)\fP. 201275970Scy.sp 202275970Scy.It Fl s , Fl \-slew 203275970ScyOK to 'slew' the time with \fBadjtime(2)\fP. 204275970Scy.sp 205275970Scy.It Fl t Ar seconds , Fl \-timeout Ns = Ns Ar seconds 206275970ScyThe number of seconds to wait for responses. 207275970ScyThis option takes an integer number as its argument. 208275970ScyThe default 209275970Scy.Ar seconds 210275970Scyfor this option is: 211275970Scy.ti +4 212275970Scy 5 213275970Scy.sp 214275970ScyWhen waiting for a reply, \fBsntp\fP will wait the number 215275970Scyof seconds specified before giving up. The default should be 216275970Scymore than enough for a unicast response. If \fBsntp\fP is 217275970Scyonly waiting for a broadcast response a longer timeout is 218275970Scylikely needed. 219309007Sdelphij.It Fl \-wait , Fl \-no\-wait 220275970ScyWait for pending replies (if not setting the time). 221275970ScyThe \fIno\-wait\fP form will disable the option. 222275970ScyThis option is enabled by default. 223275970Scy.sp 224275970ScyIf we are not setting the time, wait for all pending responses. 225275970Scy.It Fl \&? , Fl \-help 226275970ScyDisplay usage information and exit. 227275970Scy.It Fl \&! , Fl \-more\-help 228275970ScyPass the extended usage information through a pager. 229275970Scy.It Fl > Oo Ar cfgfile Oc , Fl \-save\-opts Oo Ns = Ns Ar cfgfile Oc 230275970ScySave the option state to \fIcfgfile\fP. The default is the \fIlast\fP 231275970Scyconfiguration file listed in the \fBOPTION PRESETS\fP section, below. 232275970ScyThe command will exit after updating the config file. 233275970Scy.It Fl < Ar cfgfile , Fl \-load\-opts Ns = Ns Ar cfgfile , Fl \-no\-load\-opts 234275970ScyLoad options from \fIcfgfile\fP. 235275970ScyThe \fIno\-load\-opts\fP form will disable the loading 236275970Scyof earlier config/rc/ini files. \fI\-\-no\-load\-opts\fP is handled early, 237275970Scyout of order. 238275970Scy.It Fl \-version Op Brq Ar v|c|n 239275970ScyOutput version of program and exit. The default mode is `v', a simple 240275970Scyversion. The `c' mode will print copyright information and `n' will 241275970Scyprint the full copyright notice. 242275970Scy.El 243275970Scy.Sh "OPTION PRESETS" 244275970ScyAny option that is not marked as \fInot presettable\fP may be preset 245275970Scyby loading values from configuration ("RC" or ".INI") file(s) and values from 246275970Scyenvironment variables named: 247275970Scy.nf 248275970Scy \fBSNTP_<option\-name>\fP or \fBSNTP\fP 249275970Scy.fi 250275970Scy.ad 251275970ScyThe environmental presets take precedence (are processed later than) 252275970Scythe configuration files. 253275970ScyThe \fIhomerc\fP files are "\fI$HOME\fP", and "\fI.\fP". 254275970ScyIf any of these are directories, then the file \fI.ntprc\fP 255275970Scyis searched for within those directories. 256275970Scy.Sh USAGE 257275970Scy.Bl -tag -width indent 258275970Scy.It Li "sntp ntpserver.somewhere" 259275970Scyis the simplest use of this program 260275970Scyand can be run as an unprivileged command 261275970Scyto check the current time and error in the local clock. 262280849Scy.It Li "sntp \-Ss \-M 128 ntpserver.somewhere" 263275970ScyWith suitable privilege, 264275970Scyrun as a command 265275970Scyor from a 266275970Scy.Xr cron 8 267275970Scyjob, 268280849Scy.Ic "sntp \-Ss \-M 128 ntpserver.somewhere" 269280849Scywill request the time from the server, 270280849Scyand if that server reports that it is synchronized 271280849Scythen if the offset adjustment is less than 128 milliseconds 272280849Scythe correction will be slewed, 273280849Scyand if the correction is more than 128 milliseconds 274280849Scythe correction will be stepped. 275280849Scy.It Li "sntp \-S ntpserver.somewhere" 276280849ScyWith suitable privilege, 277280849Scyrun as a command 278280849Scyor from a 279280849Scy.Xr cron 8 280280849Scyjob, 281280849Scy.Ic "sntp \-S ntpserver.somewhere" 282280849Scywill set (step) the local clock from a synchronized specified server, 283275970Scylike the (deprecated) 284275970Scy.Xr ntpdate 1ntpdatemdoc , 285275970Scyor 286275970Scy.Xr rdate 8 287275970Scycommands. 288275970Scy.El 289275970Scy.Sh "ENVIRONMENT" 290275970ScySee \fBOPTION PRESETS\fP for configuration environment variables. 291275970Scy.Sh "FILES" 292275970ScySee \fBOPTION PRESETS\fP for configuration files. 293275970Scy.Sh "EXIT STATUS" 294275970ScyOne of the following exit values will be returned: 295275970Scy.Bl -tag 296275970Scy.It 0 " (EXIT_SUCCESS)" 297275970ScySuccessful program execution. 298275970Scy.It 1 " (EXIT_FAILURE)" 299275970ScyThe operation failed or the command syntax was not valid. 300275970Scy.It 66 " (EX_NOINPUT)" 301275970ScyA specified configuration file could not be loaded. 302275970Scy.It 70 " (EX_SOFTWARE)" 303275970Scylibopts had an internal operational error. Please report 304275970Scyit to autogen\-users@lists.sourceforge.net. Thank you. 305275970Scy.El 306275970Scy.Sh AUTHORS 307275970Scy.An "Johannes Maximilian Kuehn" 308275970Scy.An "Harlan Stenn" 309275970Scy.An "Dave Hart" 310275970Scy.Sh "COPYRIGHT" 311358659ScyCopyright (C) 1992\-2020 The University of Delaware and Network Time Foundation all rights reserved. 312275970ScyThis program is released under the terms of the NTP license, <http://ntp.org/license>. 313275970Scy.Sh "BUGS" 314275970ScyPlease send bug reports to: http://bugs.ntp.org, bugs@ntp.org 315275970Scy.Sh "NOTES" 316275970ScyThis manual page was \fIAutoGen\fP\-erated from the \fBsntp\fP 317275970Scyoption definitions. 318