mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-21 11:13:30 +00:00
117 lines
3.6 KiB
Groff
117 lines
3.6 KiB
Groff
.\"
|
|
.\" Copyright (c) 2003 Tom Rhodes
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, are permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\"
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
.\" SUCH DAMAGE.
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.\"
|
|
.Dd June 21, 2003
|
|
.Dt NTP_GETTIME 2
|
|
.Os
|
|
.Sh NAME
|
|
.Nm ntp_gettime
|
|
.Nd NTP user application interface
|
|
.Sh SYNOPSIS
|
|
.In sys/timex.h
|
|
.Ft int
|
|
.Fn ntp_gettime "struct ntptimeval *ntv"
|
|
.Sh DESCRIPTION
|
|
The time returned by
|
|
.Fn ntp_gettime
|
|
is in a
|
|
.Vt timespec
|
|
structure, but may be in either microsecond
|
|
(seconds and microseconds) or nanosecond (seconds and nanoseconds) format.
|
|
The particular format in use is determined by the
|
|
.Dv STA_NANO
|
|
bit of the status
|
|
word returned by the
|
|
.Fn ntp_adjtime
|
|
system call.
|
|
.Fn ntp_gettime
|
|
has as argument a pointer to the
|
|
.Vt ntptimeval
|
|
structure with the following members:
|
|
.Bd -literal
|
|
struct ntptimeval {
|
|
struct timespec time; /* current time (ns) (ro) */
|
|
long maxerror; /* maximum error (us) (ro) */
|
|
long esterror; /* estimated error (us) (ro) */
|
|
long tai; /* TAI-UTC offset */
|
|
int time_state; /* time status */
|
|
};
|
|
.Ed
|
|
.Pp
|
|
These are understood as:
|
|
.Bl -tag -width ".Va time_state"
|
|
.It Va time
|
|
Current time (read-only).
|
|
.It Va maxerror
|
|
Maximum error in microseconds (read-only).
|
|
.It Va esterror
|
|
Estimated error in microseconds (read-only).
|
|
.It Va tai
|
|
Offset in seconds between the TAI and UTC time scales.
|
|
This offset is published twice a year and is an integral number of
|
|
seconds between TAI (which does not have leap seconds) and UTC (which
|
|
does).
|
|
.Xr ntpd 8
|
|
or some other agent maintains this value.
|
|
A value of 0 means unknown.
|
|
As of the date of the manual page, the offset is 32 seconds.
|
|
.It Va time_state
|
|
Current time status.
|
|
.El
|
|
.Sh RETURN VALUES
|
|
.Rv -std ntp_gettime
|
|
.Pp
|
|
Possible states of the clock are:
|
|
.Pp
|
|
.Bl -tag -compact -width ".Dv TIME_ERROR"
|
|
.It Dv TIME_OK
|
|
Everything okay, no leap second warning.
|
|
.It Dv TIME_INS
|
|
Positive leap second warning.
|
|
At the end of the day, an additional second will be inserted after 23:59:59.
|
|
.It Dv TIME_DEL
|
|
Negative leap second warning.
|
|
At the end of the day, 23:59:59 is skipped.
|
|
.It Dv TIME_OOP
|
|
Leap second in progress.
|
|
.It Dv TIME_WAIT
|
|
Leap second has occurred.
|
|
.It Dv TIME_ERROR
|
|
Clock not synchronized.
|
|
.El
|
|
.Sh SEE ALSO
|
|
.Xr ntp_adjtime 2 ,
|
|
.Xr ntpd 8
|
|
.Bl -tag -width indent
|
|
.It Pa http://www.bipm.fr/enus/5_Scientific/c_time/time_1.html
|
|
.It Pa http://www.boulder.nist.gov/timefreq/general/faq.htm
|
|
.It Pa ftp://time.nist.gov/pub/leap-seconds.list
|
|
.El
|
|
.Sh AUTHORS
|
|
This manual page was written by
|
|
.An Tom Rhodes Aq trhodes@FreeBSD.org .
|