219 lines
5.2 KiB
HTML
219 lines
5.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of NTP_GETTIME</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>NTP_GETTIME</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
ntp_gettime, ntp_gettimex - get time parameters (NTP daemon interface)
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/sys/timex.h">sys/timex.h</A>></B>
|
|
|
|
<B>int ntp_gettime(struct ntptimeval *</B><I>ntv</I><B>);</B>
|
|
|
|
<B>int ntp_gettimex(struct ntptimeval *</B><I>ntv</I><B>);</B>
|
|
</PRE>
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
Both of these APIs return information to the caller via the
|
|
<I>ntv</I>
|
|
|
|
argument, a structure of the following type:
|
|
<P>
|
|
|
|
|
|
|
|
struct ntptimeval {
|
|
<BR> struct timeval time; /* Current time */
|
|
<BR> long int maxerror; /* Maximum error */
|
|
<BR> long int esterror; /* Estimated error */
|
|
<BR> long int tai; /* TAI offset */
|
|
<P>
|
|
<BR> /* Further padding bytes allowing for future expansion */
|
|
};
|
|
|
|
|
|
<P>
|
|
|
|
The fields of this structure are as follows:
|
|
<DL COMPACT>
|
|
<DT id="1"><I>time</I>
|
|
|
|
<DD>
|
|
The current time, expressed as a
|
|
<I>timeval</I>
|
|
|
|
structure:
|
|
<DT id="2"><DD>
|
|
|
|
|
|
struct timeval {
|
|
<BR> time_t tv_sec; /* Seconds since the Epoch */
|
|
<BR> suseconds_t tv_usec; /* Microseconds */
|
|
};
|
|
|
|
|
|
<DT id="3"><DD>
|
|
<DT id="4"><I>maxerror</I>
|
|
|
|
<DD>
|
|
Maximum error, in microseconds.
|
|
This value can be initialized by
|
|
<B><A HREF="/cgi-bin/man/man2html?3+ntp_adjtime">ntp_adjtime</A></B>(3),
|
|
|
|
and is increased periodically (on Linux: each second),
|
|
but is clamped to an upper limit (the kernel constant
|
|
<B>NTP_PHASE_MAX</B>,
|
|
|
|
with a value of 16,000).
|
|
<DT id="5"><I>esterror</I>
|
|
|
|
<DD>
|
|
Estimated error, in microseconds.
|
|
This value can be set via
|
|
<B><A HREF="/cgi-bin/man/man2html?3+ntp_adjtime">ntp_adjtime</A></B>(3)
|
|
|
|
to contain an estimate of the difference between the system clock
|
|
and the true time.
|
|
This value is not used inside the kernel.
|
|
<DT id="6"><I>tai</I>
|
|
|
|
<DD>
|
|
TAI (Atomic International Time) offset.
|
|
</DL>
|
|
<P>
|
|
|
|
<B>ntp_gettime</B>()
|
|
|
|
returns an
|
|
<I>ntptimeval</I>
|
|
|
|
structure in which the
|
|
<I>time</I>,
|
|
|
|
<I>maxerror</I>,
|
|
|
|
and
|
|
<I>esterror</I>
|
|
|
|
fields are filled in.
|
|
<P>
|
|
|
|
<B>ntp_gettimex</B>()
|
|
|
|
performs the same task as
|
|
<B>ntp_gettime</B>(),
|
|
|
|
but also returns information in the
|
|
<I>tai</I>
|
|
|
|
field.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
The return values for
|
|
<B>ntp_gettime</B>()
|
|
|
|
and
|
|
<B>ntp_gettimex</B>()
|
|
|
|
are as for
|
|
<B><A HREF="/cgi-bin/man/man2html?2+adjtimex">adjtimex</A></B>(2).
|
|
|
|
Given a correct pointer argument, these functions always succeed.
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
The
|
|
<B>ntp_gettime</B>()
|
|
|
|
function is available since glibc 2.1.
|
|
The
|
|
<B>ntp_gettimex</B>()
|
|
|
|
function is available since glibc 2.12.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>ntp_gettime</B>(),
|
|
|
|
<B>ntp_gettimex</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
<B>ntp_gettime</B>()
|
|
|
|
is described in the NTP Kernel Application Program Interface.
|
|
<B>ntp_gettimex</B>()
|
|
|
|
is a GNU extension.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+adjtimex">adjtimex</A></B>(2)
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+ntp_adjtime">ntp_adjtime</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+time">time</A></B>(7)
|
|
|
|
<P>
|
|
|
|
|
|
|
|
NTP "Kernel Application Program Interface"
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="7"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="8"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="9"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="10"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="11"><A HREF="#lbAF">VERSIONS</A><DD>
|
|
<DT id="12"><A HREF="#lbAG">ATTRIBUTES</A><DD>
|
|
<DT id="13"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="14"><A HREF="#lbAI">SEE ALSO</A><DD>
|
|
<DT id="15"><A HREF="#lbAJ">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:49 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|