NAME¶
sntp - standard Simple Network Time Protocol program
SYNOPSIS¶
sntp [
-flag [
value]]... [
--opt-name
[[=| ]
value]]...
[ hostname-or-IP ...]
DESCRIPTION¶
This manual page briefly documents the
sntp command.
sntp can be
used as a SNTP client to query a NTP or SNTP server and either display the
time or set the local system's time (given suitable privilege). It can be run
as an interactive command or in a
cron job.
NTP (the Network Time Protocol) and SNTP (the Simple Network Time Protocol) are
defined and described by RFC 5905.
The default is to write the estimated correct local date and time (i.e. not UTC)
to the standard output in a format like
'1996-10-15 20:17:25.123 (+0800)
+4.567 +/- 0.089 secs', where the
'(+0800)' means that to get to
UTC from the reported local time one must add 8 hours and 0 minutes, and the
'+4.567 +/- 0.089 secs' indicates the local clock is 4.567 seconds
behind the correct time (so 4.567 seconds must be added to the local clock to
get it to be correct), and the time of '1996-10-15 20:17:25.123' is believed
to be correct to within +/- 0.089 seconds.
OPTIONS¶
- -4, --ipv4
- Force IPv4 DNS name resolution. This option must not appear in combination
with any of the following options: ipv6.
Force DNS resolution of the following host names on the command line to the
IPv4 namespace.
- -6, --ipv6
- Force IPv6 DNS name resolution. This option must not appear in combination
with any of the following options: ipv4.
Force DNS resolution of the following host names on the command line to the
IPv6 namespace.
- -d, --normalverbose
- Normal verbose.
Diagnostic messages for non-fatal errors and a limited amount of tracing
should be written to standard error. Fatal ones always produce a
diagnostic. This option should be set when there is a suspected problem
with the server, network or the source.
- -K file-name, --kod=file-name
- KoD history filename.
Specifies the filename to be used to persist the history of KoD responses
received from servers. The default is /var/db/ntp-kod.
- -p, --syslog
- Logging with syslog. This option must not appear in combination with any
of the following options: logfile.
When this option is set all logging will be done using syslog.
- -l file-name, --logfile=file-name
- Log to specified logfile. This option must not appear in combination with
any of the following options: syslog.
This option causes the client to write log messages to the specified
logfile.
- -s, --settod
- Set (step) the time with settimeofday(). This option must not appear in
combination with any of the following options: adjtime.
- -j, --adjtime
- Set (slew) the time with adjtime(). This option must not appear in
combination with any of the following options: settod.
- -b broadcast-address,
--broadcast=broadcast-address
- Use broadcasts to the address specified for synchronisation.
If specified SNTP will listen to the specified broadcast address for NTP
broadcasts. The default maximum wait time, 68 seconds, can be modified
with -t.
- -t seconds, --timeout=seconds
- Specify the number of seconds to wait for broadcasts. This option takes an
integer number as its argument. The default seconds for this option
is:
68
When waiting for a broadcast packet SNTP will wait the number of seconds
specified before giving up. Default 68 seconds.
- -a auth-keynumber,
--authentication=auth-keynumber
- Enable authentication with the key auth-keynumber. This option takes an
integer number as its argument.
This option enables authentication using the key specified in this option's
argument. The argument of this option is the keyid, a number specified in
the keyfile as this key's identifier. See the keyfile option (-k) for more
details.
- -k file-name, --keyfile=file-name
- Specify a keyfile. SNTP will look in this file for the key specified with
-a.
This option specifies the keyfile. SNTP will search for the key specified
with -a keyno in this file. Key files follow the following format:
keyid keytype key
Where keyid is a number identifying this key keytype is one of the follow: S
Key in 64 Bit hexadecimal number as specified in in the DES specification.
N Key in 64 Bit hexadecimal number as specified in the NTP standard. A Key
in a 1-to-8 character ASCII string. M Key in a 1-to-8 character ASCII
string using the MD5 authentication scheme.
For more information see ntp.keys(5).
- -?, --help
- Display extended usage information and exit.
- -!, --more-help
- Extended usage information passed thru pager.
- -> [rcfile], --save-opts[=rcfile]
- Save the option state to rcfile. The default is the last
configuration file listed in the OPTION PRESETS section,
below.
- -< rcfile, --load-opts=rcfile,
--no-load-opts
- Load options from rcfile. The no-load-opts form will disable
the loading of earlier RC/INI files. --no-load-opts is handled
early, out of order.
- - [{v|c|n}], --version[={v|c|n}]
- Output version of program and exit. The default mode is `v', a simple
version. The `c' mode will print copyright information and `n' will print
the full copyright notice.
OPTION PRESETS¶
Any option that is not marked as
not presettable may be preset by loading
values from configuration ("RC" or ".INI") file(s) and
values from environment variables named:
SNTP_<option-name> or SNTP
The environmental presets take precedence (are processed later than) the
configuration files. The
homerc files are "
$HOME", and
"
.". If any of these are directories, then the file
.ntprc is searched for within those directories.
USAGE¶
The simplest use of this program is as an unprivileged command to check the
current time and error in the local clock. For example:
- sntp ntpserver.somewhere
With suitable privilege, it can be run as a command or in a
cron job to
reset the local clock from a reliable server, like the
ntpdate and
rdate commands. For example:
- sntp -a ntpserver.somewhere
RETURN VALUE¶
The program returns a zero exit status for success, and a non-zero one
otherwise.
BUGS¶
Please report bugs to
http://bugs.ntp.org .
AUTHOR¶
David L. Mills and/or others
Please send bug reports to:
http://bugs.ntp.org, bugs@ntp.org
see html/copyright.html
This manual page was
AutoGen-erated from the
sntp option
definitions.