1 .\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH NTP_GETTIME 3 2021-03-22 "Linux" "Linux Programmer's Manual"
27 ntp_gettime, ntp_gettimex \- get time parameters (NTP daemon interface)
30 .B #include <sys/timex.h>
32 .BI "int ntp_gettime(struct ntptimeval *" ntv );
33 .BI "int ntp_gettimex(struct ntptimeval *" ntv );
36 Both of these APIs return information to the caller via the
38 argument, a structure of the following type:
43 struct timeval time; /* Current time */
44 long maxerror; /* Maximum error */
45 long esterror; /* Estimated error */
46 long tai; /* TAI offset */
48 /* Further padding bytes allowing for future expansion */
53 The fields of this structure are as follows:
56 The current time, expressed as a
63 time_t tv_sec; /* Seconds since the Epoch */
64 suseconds_t tv_usec; /* Microseconds */
70 Maximum error, in microseconds.
71 This value can be initialized by
73 and is increased periodically (on Linux: each second),
74 but is clamped to an upper limit (the kernel constant
76 with a value of 16,000).
79 Estimated error, in microseconds.
80 This value can be set via
82 to contain an estimate of the difference between the system clock
84 This value is not used inside the kernel.
87 TAI (Atomic International Time) offset.
92 structure in which the
100 performs the same task as
102 but also returns information in the
106 The return values for
112 Given a correct pointer argument, these functions always succeed.
113 .\" FIXME . the info page incorrectly describes the return values.
117 function is available since glibc 2.1.
120 function is available since glibc 2.12.
122 For an explanation of the terms used in this section, see
130 Interface Attribute Value
134 T} Thread safety MT-Safe
141 is described in the NTP Kernel Application Program Interface.
150 .UR http://www.slac.stanford.edu/comp/unix/\:package/\:rtems/\:src/\:ssrlApps/\:ntpNanoclock/\:api.htm
151 NTP "Kernel Application Program Interface"