components/ntp/manpages/ntpdate.1m
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 433 5de96cdbdfcb
permissions -rw-r--r--
Close of build 10.

'\" te
.\" CDDL HEADER START
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\" CDDL HEADER END
.\"
.\" Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
.\"
.TH "ntpdate" "1M" "" "" "System Administration Commands"
.SH NAME
ntpdate \- set the date and time with NTP
.SH SYNOPSIS
.LP
.B /usr/sbin/ntpdate
[\fB-46bBdqsuv\fR] [\fB-a\fR \fIkey\fR] [\fB-e\fR \fIAuthdelay\fR] [\fB-k\fR \fIkeyfile\fR] [\fB-o\fR \fIversion\fR] [\fB-p\fR \fIsamples\fR] [\fB-t\fR \fItimeout\fR] \fIserver\fR [ ... ]
.SH "OPTIONS"
.TP
.BR "-4"
Force DNS resolution of following host names on the command line to the IPv4 namespace.
.TP
.BR "-6"
Force DNS resolution of following host names on the command line to the IPv6 namespace.
.TP
.BR "-a \fIkey\fP"
Enable authentication and specify the key identifier to be used for authentication as the argument \fIkey\fR. The keys and key identifiers must match in both the client and server key files. The default is to disable authentication.
.TP
.BR "-B"
Force the time to always be slewed using the adjtime() system call, even if the measured offset is greater than 0.5 seconds. The default is to step the time using settimeofday() if the offset is greater than +-0.5s. Note that, if the offset is much greater than +-0.5s in this case, that it can take a long time (hours) to slew the clock to the correct value. During this time, the host should not be used to synchronize clients.
.TP
.BR "-b"
Force the time to be stepped using the settimeofday() system call, rather than slewed (default) using the adjtime() system call. This option should be used when called from a startup file at boot time.
.TP
.BR "-d "
Enable the debugging mode, in which \fBntpdate\fR will go through all the steps, but not adjust the local clock. Information useful for general debugging will also be printed.
.TP
.BR "-e \fIauthdelay\fP"
Specify the processing delay to perform an authentication function as the value \fIauthdelay\fR, in seconds and fraction (see \fBntpd\fR for details). This number is usually small enough to be negligible for most purposes, though specifying a value may improve timekeeping on very slow CPU's.
.TP
.BR "-k \fIkeyfile\fP"
Specify the path for the authentication key file as the string \fIkeyfile\fR. The default is \fB/etc/inet/ntp.keys\fR. This file should be in the format described in \fBntpd\fR.
.TP
.BR "-o \fIversion\fP"
Specify the NTP version for outgoing packets as the integer \fIversion\fR, which can be 1 or 2. The default is 3. This allows \fBntpdate\fR to be used with older NTP versions.
.TP
.BR "-p \fIsamples\fP"
Specify the number of samples to be acquired from each server as the integer \fIsamples\fR, with values from 1 to 8 inclusive. The default is 4.
.TP
.BR "-q"
Query only - don't set the clock.
.TP
.BR "-s"
Divert logging output from the standard output (default) to the system \fBsyslog\fR facility.
.TP
.BR "-t \fItimeout\fP"
Specify the maximum time waiting for a server response as the value \fItimeout\fR, in seconds and fraction. The value is is rounded to a multiple of 0.2 seconds. The default is 1 second, a value suitable for polling across a LAN.
.TP
.BR "-u"
Direct \fBntpdate\fR to use an unprivileged port or outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and you want to synchronise with hosts beyond the firewall. Note that the \fB-d\fR option always uses unprivileged ports.
.TP
.BR "-v"
Print \fBntpdate\fR's version identification string during program startup.
.SH "DESCRIPTION"
\fBntpdate\fR sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the \fIserver\fR arguments to determine the correct time. It must be run as root unless the \fB-d\fR or \fB-q\fR options are used. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of \fBntpdate\fR depends on the number of servers, the number of polls each time it is run and the interval between runs.
.LP
\fBntpdate\fR can be run manually as necessary to set the host clock, or it can be run from the host startup script to set the clock at boot time. It is also possible to run \fBntpdate\fR from a \fBcron\fR script. However, it is important to note that \fBntpdate\fR with contrived \fBcron\fR scripts is no substitute for the NTP daemon, which uses sophisticated algorithms to maximize accuracy and reliability while minimizing resource use. Finally, since \fBntpdate\fR does not discipline the host clock frequency as does \fBntpd\fR, the accuracy using \fBntpdate\fR is limited.
.LP
Time adjustments are made by \fBntpdate\fR in one of two ways. If \fBntpdate\fR determines the clock is in error more than 0.5 second it will simply step the time by calling the system \fBsettimeofday()\fR routine. If the error is less than 0.5 seconds, it will slew the time by calling the system \fBadjtime()\fR routine. The latter technique is less disruptive and more accurate when the error is small, and works quite well when \fBntpdate\fR is run by \fBcron\fR every hour or two.
\fBntpdate\fR will decline to set the date if an NTP server daemon (e.g., \fBntpd\fR) is running on the same host. When running \fBntpdate\fR on a regular basis from \fBcron\fR as an alternative to running a daemon, doing so once every hour or two will result in precise enough timekeeping to avoid stepping the clock.
Note that in contexts where a host name is expected, a \fB-4\fR qualifier preceding the host name forces DNS resolution to the IPv4 namespace, while a \fB-6\fR qualifier forces DNS resolution to the IPv6 namespace.
.PP
.SH NOTES
Disclaimer: The functionality of this program is now available in the \fBntpd\fB program. See the \fB-q\fB command line option in the \fBntpd\fB - Network Time Protocol (NTP) daemon man page. The \fBntpdate\fB program is to be retired from this distribution.
.TE
.PP
.SH SEE ALSO
.LP
\fBntpd\fR(1M), \fBntpdc\fR(1M), \fBattributes\fR(5)