1ntp_gettime(3)             Library Functions Manual             ntp_gettime(3)
2
3
4

NAME

6       ntp_gettime, ntp_gettimex  - get time parameters (NTP daemon interface)
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <sys/timex.h>
13
14       int ntp_gettime(struct ntptimeval *ntv);
15       int ntp_gettimex(struct ntptimeval *ntv);
16

DESCRIPTION

18       Both  of  these APIs return information to the caller via the ntv argu‐
19       ment, a structure of the following type:
20
21           struct ntptimeval {
22               struct timeval time;    /* Current time */
23               long maxerror;          /* Maximum error */
24               long esterror;          /* Estimated error */
25               long tai;               /* TAI offset */
26
27               /* Further padding bytes allowing for future expansion */
28           };
29
30       The fields of this structure are as follows:
31
32       time   The current time, expressed as a timeval structure:
33
34                  struct timeval {
35                      time_t      tv_sec;   /* Seconds since the Epoch */
36                      suseconds_t tv_usec;  /* Microseconds */
37                  };
38
39       maxerror
40              Maximum error, in microseconds.  This value can  be  initialized
41              by ntp_adjtime(3), and is increased periodically (on Linux: each
42              second), but is clamped to an upper limit (the  kernel  constant
43              NTP_PHASE_MAX, with a value of 16,000).
44
45       esterror
46              Estimated  error,  in  microseconds.   This value can be set via
47              ntp_adjtime(3) to contain an estimate of the difference  between
48              the  system clock and the true time.  This value is not used in‐
49              side the kernel.
50
51       tai    TAI (Atomic International Time) offset.
52
53       ntp_gettime() returns an ntptimeval structure in which the time, maxer‐
54       ror, and esterror fields are filled in.
55
56       ntp_gettimex()  performs  the  same task as ntp_gettime(), but also re‐
57       turns information in the tai field.
58

RETURN VALUE

60       The return values for ntp_gettime() and ntp_gettimex() are as for  adj‐
61       timex(2).   Given  a  correct  pointer argument, these functions always
62       succeed.
63

ATTRIBUTES

65       For an  explanation  of  the  terms  used  in  this  section,  see  at‐
66       tributes(7).
67
68       ┌────────────────────────────────────────────┬───────────────┬─────────┐
69Interface                                   Attribute     Value   
70       ├────────────────────────────────────────────┼───────────────┼─────────┤
71ntp_gettime(), ntp_gettimex()               │ Thread safety │ MT-Safe │
72       └────────────────────────────────────────────┴───────────────┴─────────┘
73

STANDARDS

75       ntp_gettime()
76              NTP Kernel Application Program Interface.
77
78       ntp_gettimex()
79              GNU.
80

HISTORY

82       ntp_gettime()
83              glibc 2.1.
84
85       ntp_gettimex()
86              glibc 2.12.
87

SEE ALSO

89       adjtimex(2), ntp_adjtime(3), time(7)
90
91       NTP "Kernel Application Program Interface"
92http://www.slac.stanford.edu/comp/unix/package/rtems/src/ssrlApps/
93       ntpNanoclock/api.htm⟩
94
95
96
97Linux man-pages 6.05              2023-07-20                    ntp_gettime(3)
Impressum