summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/ntp_gettime.2
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/sys/ntp_gettime.2')
-rw-r--r--lib/libc/sys/ntp_gettime.2104
1 files changed, 104 insertions, 0 deletions
diff --git a/lib/libc/sys/ntp_gettime.2 b/lib/libc/sys/ntp_gettime.2
new file mode 100644
index 0000000..7de0fed
--- /dev/null
+++ b/lib/libc/sys/ntp_gettime.2
@@ -0,0 +1,104 @@
+.\"
+.\" 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 April 1, 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 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
+Temps Atomique International (French for International Atomic Time),
+measures real time.
+Used for acute time measurements.
+.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
+Insert leap second warning.
+.It Dv TIME_DEL
+Delete leap second warning.
+.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
+.Sh AUTHORS
+This manual page was written by
+.An Tom Rhodes Aq trhodes@FreeBSD.org .
OpenPOWER on IntegriCloud