]>
Commit | Line | Data |
---|---|---|
6d78bc96 MK |
1 | .\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com> |
2 | .\" | |
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. | |
7 | .\" | |
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. | |
12 | .\" | |
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 | |
19 | .\" professionally. | |
20 | .\" | |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by | |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
23 | .\" %%%LICENSE_END | |
24 | .\" | |
4b8c67d9 | 25 | .TH NTP_GETTIME 3 2017-09-15 "Linux" "Linux Programmer's Manual" |
6d78bc96 MK |
26 | .SH NAME |
27 | ntp_gettime, ntp_gettimex \- get time parameters (NTP daemon interface) | |
28 | .SH SYNOPSIS | |
29 | .nf | |
30 | .B #include <sys/timex.h> | |
dbfe9c70 | 31 | .PP |
6d78bc96 | 32 | .BI "int ntp_gettime(struct ntptimeval *" ntv ); |
dbfe9c70 | 33 | .PP |
6d78bc96 MK |
34 | .BI "int ntp_gettimex(struct ntptimeval *" ntv ); |
35 | .fi | |
36 | .SH DESCRIPTION | |
37 | Both of these APIs return information to the caller via the | |
38 | .I ntv | |
39 | argument, a structure of the following type: | |
847e0d88 | 40 | .PP |
6d78bc96 | 41 | .in +4n |
b8302363 | 42 | .EX |
6d78bc96 MK |
43 | struct ntptimeval { |
44 | struct timeval time; /* Current time */ | |
45 | long int maxerror; /* Maximum error */ | |
46 | long int esterror; /* Estimated error */ | |
47 | long int tai; /* TAI offset */ | |
48 | ||
49 | /* Further padding bytes allowing for future expansion */ | |
50 | }; | |
b8302363 | 51 | .EE |
6d78bc96 | 52 | .in |
847e0d88 | 53 | .PP |
6d78bc96 MK |
54 | The fields of this structure are as follows: |
55 | .TP | |
56 | .I time | |
57 | The current time, expressed as a | |
58 | .I timeval | |
59 | structure: | |
847e0d88 | 60 | .IP |
6d78bc96 | 61 | .in +4n |
b8302363 | 62 | .EX |
6d78bc96 MK |
63 | struct timeval { |
64 | time_t tv_sec; /* Seconds since the Epoch */ | |
65 | suseconds_t tv_usec; /* Microseconds */ | |
66 | }; | |
e646a1ba | 67 | .EE |
6d78bc96 | 68 | .in |
e646a1ba | 69 | .IP |
6d78bc96 MK |
70 | .TP |
71 | .I maxerror | |
72 | Maximum error, in microseconds. | |
b5133e9a | 73 | This value can be initialized by |
6d78bc96 MK |
74 | .BR ntp_adjtime (3), |
75 | and is increased periodically (on Linux: each second), | |
76 | but is clamped to an upper limit (the kernel constant | |
77 | .BR NTP_PHASE_MAX , | |
78 | with a value of 16,000). | |
79 | .TP | |
80 | .I esterror | |
81 | Estimated error, in microseconds. | |
82 | This value can be set via | |
83 | .BR ntp_adjtime (3) | |
84 | to contain an estimate of the difference between the system clock | |
85 | and the true time. | |
86 | This value is not used inside the kernel. | |
87 | .TP | |
88 | .I tai | |
89 | TAI (Atomic International Time) offset. | |
90 | .PP | |
91 | .BR ntp_gettime () | |
92 | returns an | |
93 | .I ntptimeval | |
94 | structure in which the | |
95 | .IR time , | |
96 | .IR maxerror , | |
97 | and | |
98 | .IR esterror | |
99 | fields are filled in. | |
100 | .PP | |
101 | .BR ntp_gettimex () | |
102 | performs the same task as | |
103 | .BR ntp_gettime (), | |
104 | but also returns information in the | |
105 | .I tai | |
106 | field. | |
107 | .SH RETURN VALUE | |
108 | The return values for | |
109 | .BR ntp_gettime () | |
110 | and | |
111 | .BR ntp_gettimex () | |
112 | are as for | |
113 | .BR adjtimex (2). | |
b5133e9a | 114 | Given a correct pointer argument, these functions always succeed. |
6d78bc96 | 115 | .\" FIXME . the info page incorrectly describes the return values. |
355b6107 MK |
116 | .SH VERSIONS |
117 | The | |
118 | .BR ntp_gettime () | |
119 | function is available since glibc 2.1. | |
120 | The | |
121 | .BR ntp_gettimex () | |
122 | function is available since glibc 2.12. | |
85c30f7e MK |
123 | .SH ATTRIBUTES |
124 | For an explanation of the terms used in this section, see | |
125 | .BR attributes (7). | |
126 | .TS | |
127 | allbox; | |
128 | lbw30 lb lb | |
129 | l l l. | |
130 | Interface Attribute Value | |
131 | T{ | |
132 | .BR ntp_gettime (), | |
133 | .BR ntp_gettimex () | |
134 | T} Thread safety MT-Safe | |
135 | .TE | |
6d78bc96 MK |
136 | .SH CONFORMING TO |
137 | .BR ntp_gettime () | |
138 | is described in the NTP Kernel Application Program Interface. | |
139 | .BR ntp_gettimex () | |
140 | is a GNU extension. | |
141 | .SH SEE ALSO | |
142 | .BR adjtimex (2) | |
143 | .BR ntp_adjtime (3), | |
144 | .BR time (7) | |
847e0d88 | 145 | .PP |
6d78bc96 MK |
146 | .ad l |
147 | .UR http://www.slac.stanford.edu/comp/unix/\:package/\:rtems/\:src/\:ssrlApps/\:ntpNanoclock/\:api.htm | |
148 | NTP "Kernel Application Program Interface" | |
149 | .UE |