]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ntp_gettime.3
Many pages: Fix style issues reported by `make lint-groff`
[thirdparty/man-pages.git] / man3 / ntp_gettime.3
CommitLineData
6d78bc96
MK
1.\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
2.\"
5fbde956 3.\" SPDX-License-Identifier: Linux-man-pages-copyleft
6d78bc96 4.\"
1d767b55 5.TH NTP_GETTIME 3 2021-03-22 "Linux" "Linux Programmer's Manual"
6d78bc96
MK
6.SH NAME
7ntp_gettime, ntp_gettimex \- get time parameters (NTP daemon interface)
1d2b8fb8
AC
8.SH LIBRARY
9Standard C library
8fc3b2cf 10.RI ( libc ", " \-lc )
6d78bc96
MK
11.SH SYNOPSIS
12.nf
13.B #include <sys/timex.h>
dbfe9c70 14.PP
6d78bc96 15.BI "int ntp_gettime(struct ntptimeval *" ntv );
6d78bc96
MK
16.BI "int ntp_gettimex(struct ntptimeval *" ntv );
17.fi
18.SH DESCRIPTION
19Both of these APIs return information to the caller via the
20.I ntv
21argument, a structure of the following type:
847e0d88 22.PP
6d78bc96 23.in +4n
b8302363 24.EX
6d78bc96 25struct ntptimeval {
ae85f653
AC
26 struct timeval time; /* Current time */
27 long maxerror; /* Maximum error */
28 long esterror; /* Estimated error */
29 long tai; /* TAI offset */
6d78bc96
MK
30
31 /* Further padding bytes allowing for future expansion */
32};
b8302363 33.EE
6d78bc96 34.in
847e0d88 35.PP
6d78bc96
MK
36The fields of this structure are as follows:
37.TP
38.I time
39The current time, expressed as a
40.I timeval
41structure:
847e0d88 42.IP
6d78bc96 43.in +4n
b8302363 44.EX
6d78bc96
MK
45struct timeval {
46 time_t tv_sec; /* Seconds since the Epoch */
47 suseconds_t tv_usec; /* Microseconds */
48};
e646a1ba 49.EE
6d78bc96
MK
50.in
51.TP
52.I maxerror
53Maximum error, in microseconds.
b5133e9a 54This value can be initialized by
6d78bc96
MK
55.BR ntp_adjtime (3),
56and is increased periodically (on Linux: each second),
57but is clamped to an upper limit (the kernel constant
58.BR NTP_PHASE_MAX ,
59with a value of 16,000).
60.TP
61.I esterror
62Estimated error, in microseconds.
63This value can be set via
64.BR ntp_adjtime (3)
65to contain an estimate of the difference between the system clock
66and the true time.
67This value is not used inside the kernel.
68.TP
69.I tai
70TAI (Atomic International Time) offset.
71.PP
72.BR ntp_gettime ()
73returns an
74.I ntptimeval
75structure in which the
76.IR time ,
77.IR maxerror ,
78and
1ae6b2c7 79.I esterror
6d78bc96
MK
80fields are filled in.
81.PP
82.BR ntp_gettimex ()
83performs the same task as
84.BR ntp_gettime (),
85but also returns information in the
86.I tai
87field.
88.SH RETURN VALUE
89The return values for
90.BR ntp_gettime ()
91and
92.BR ntp_gettimex ()
93are as for
94.BR adjtimex (2).
b5133e9a 95Given a correct pointer argument, these functions always succeed.
6d78bc96 96.\" FIXME . the info page incorrectly describes the return values.
355b6107
MK
97.SH VERSIONS
98The
99.BR ntp_gettime ()
100function is available since glibc 2.1.
101The
102.BR ntp_gettimex ()
103function is available since glibc 2.12.
85c30f7e
MK
104.SH ATTRIBUTES
105For an explanation of the terms used in this section, see
106.BR attributes (7).
c466875e
MK
107.ad l
108.nh
85c30f7e
MK
109.TS
110allbox;
c466875e 111lbx lb lb
85c30f7e
MK
112l l l.
113Interface Attribute Value
114T{
115.BR ntp_gettime (),
116.BR ntp_gettimex ()
117T} Thread safety MT-Safe
118.TE
c466875e
MK
119.hy
120.ad
121.sp 1
6d78bc96
MK
122.SH CONFORMING TO
123.BR ntp_gettime ()
124is described in the NTP Kernel Application Program Interface.
125.BR ntp_gettimex ()
126is a GNU extension.
127.SH SEE ALSO
bba4bbbd 128.BR adjtimex (2),
6d78bc96
MK
129.BR ntp_adjtime (3),
130.BR time (7)
847e0d88 131.PP
6d78bc96
MK
132.ad l
133.UR http://www.slac.stanford.edu/comp/unix/\:package/\:rtems/\:src/\:ssrlApps/\:ntpNanoclock/\:api.htm
134NTP "Kernel Application Program Interface"
135.UE