2 .\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .TH ntp_gettime 3 (date) "Linux man-pages (unreleased)"
8 ntp_gettime, ntp_gettimex \- get time parameters (NTP daemon interface)
11 .RI ( libc ", " \-lc )
14 .B #include <sys/timex.h>
16 .BI "int ntp_gettime(struct ntptimeval *" ntv );
17 .BI "int ntp_gettimex(struct ntptimeval *" ntv );
20 Both of these APIs return information to the caller via the
22 argument, a structure of the following type:
27 struct timeval time; /* Current time */
28 long maxerror; /* Maximum error */
29 long esterror; /* Estimated error */
30 long tai; /* TAI offset */
32 /* Further padding bytes allowing for future expansion */
37 The fields of this structure are as follows:
40 The current time, expressed as a
47 time_t tv_sec; /* Seconds since the Epoch */
48 suseconds_t tv_usec; /* Microseconds */
54 Maximum error, in microseconds.
55 This value can be initialized by
57 and is increased periodically (on Linux: each second),
58 but is clamped to an upper limit (the kernel constant
60 with a value of 16,000).
63 Estimated error, in microseconds.
64 This value can be set via
66 to contain an estimate of the difference between the system clock
68 This value is not used inside the kernel.
71 TAI (Atomic International Time) offset.
76 structure in which the
84 performs the same task as
86 but also returns information in the
96 Given a correct pointer argument, these functions always succeed.
97 .\" FIXME . the info page incorrectly describes the return values.
101 function is available since glibc 2.1.
104 function is available since glibc 2.12.
106 For an explanation of the terms used in this section, see
114 Interface Attribute Value
118 T} Thread safety MT-Safe
125 is described in the NTP Kernel Application Program Interface.
134 .UR http://www.slac.stanford.edu/comp/unix/\:package/\:rtems/\:src/\:ssrlApps/\:ntpNanoclock/\:api.htm
135 NTP "Kernel Application Program Interface"