1 .\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .TH NTP_GETTIME 3 2021-03-22 "Linux" "Linux Programmer's Manual"
7 ntp_gettime, ntp_gettimex \- get time parameters (NTP daemon interface)
10 .RI ( libc ", " \-lc )
13 .B #include <sys/timex.h>
15 .BI "int ntp_gettime(struct ntptimeval *" ntv );
16 .BI "int ntp_gettimex(struct ntptimeval *" ntv );
19 Both of these APIs return information to the caller via the
21 argument, a structure of the following type:
26 struct timeval time; /* Current time */
27 long maxerror; /* Maximum error */
28 long esterror; /* Estimated error */
29 long tai; /* TAI offset */
31 /* Further padding bytes allowing for future expansion */
36 The fields of this structure are as follows:
39 The current time, expressed as a
46 time_t tv_sec; /* Seconds since the Epoch */
47 suseconds_t tv_usec; /* Microseconds */
53 Maximum error, in microseconds.
54 This value can be initialized by
56 and is increased periodically (on Linux: each second),
57 but is clamped to an upper limit (the kernel constant
59 with a value of 16,000).
62 Estimated error, in microseconds.
63 This value can be set via
65 to contain an estimate of the difference between the system clock
67 This value is not used inside the kernel.
70 TAI (Atomic International Time) offset.
75 structure in which the
83 performs the same task as
85 but also returns information in the
95 Given a correct pointer argument, these functions always succeed.
96 .\" FIXME . the info page incorrectly describes the return values.
100 function is available since glibc 2.1.
103 function is available since glibc 2.12.
105 For an explanation of the terms used in this section, see
113 Interface Attribute Value
117 T} Thread safety MT-Safe
124 is described in the NTP Kernel Application Program Interface.
133 .UR http://www.slac.stanford.edu/comp/unix/\:package/\:rtems/\:src/\:ssrlApps/\:ntpNanoclock/\:api.htm
134 NTP "Kernel Application Program Interface"