Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


NTP_GETTIME(3) Linux Programmer's Manual NTP_GETTIME(3)


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


     #include <sys/timex.h>
     int ntp_gettime(struct ntptimeval *ntv);
     int ntp_gettimex(struct ntptimeval *ntv);


     Both of these APIs return information to the caller via the  ntv  argu-
     ment, a structure of the following type:
         struct ntptimeval {
             struct timeval time;        /* Current time */
             long int maxerror;          /* Maximum error */
             long int esterror;          /* Estimated error */
             long int tai;               /* TAI offset */
             /* Further padding bytes allowing for future expansion */ };
     The fields of this structure are as follows:
     time   The current time, expressed as a timeval structure:
                struct timeval {
                    time_t      tv_sec;   /* Seconds since the Epoch */
                    suseconds_t tv_usec;  /* Microseconds */ };
            Maximum  error,  in microseconds.  This value can be initialized
            by ntp_adjtime(3), and is increased periodically (on Linux: each
            second),  but  is clamped to an upper limit (the kernel constant
            NTP_PHASE_MAX, with a value of 16,000).
            Estimated error, in microseconds.  This value  can  be  set  via
            ntp_adjtime(3)  to contain an estimate of the difference between
            the system clock and the true time.   This  value  is  not  used
            inside the kernel.
     tai    TAI (Atomic International Time) offset.
     ntp_gettime() returns an ntptimeval structure in which the time, maxer-
     ror, and esterror fields are filled in.
     ntp_gettimex() performs  the  same  task  as  ntp_gettime(),  but  also
     returns information in the tai field.


     The  return values for ntp_gettime() and ntp_gettimex() are as for adj-
     timex(2).  Given a correct pointer  argument,  these  functions  always


     The  ntp_gettime() function is available since glibc 2.1.  The ntp_get-
     timex() function is available since glibc 2.12.


     For  an  explanation  of  the  terms  used   in   this   section,   see
     allbox; lbw30 lb lb l l l.  Interface Attribute Value T{ ntp_gettime(),
     ntp_gettimex() T}   Thread safety  MT-Safe


     ntp_gettime() is described in the NTP Kernel Application Program Inter-
     face.  ntp_gettimex() is a GNU extension.


     adjtimex(2) ntp_adjtime(3), time(7)
     NTP "Kernel Application Program Interface"


     This page is part of release 4.16 of the Linux man-pages project.  A
     description of the project, information about reporting bugs, and the
     latest version of this page, can be found at

Linux 2017-09-15 NTP_GETTIME(3)

/data/webs/external/dokuwiki/data/pages/man/ntp_gettimex.txt · Last modified: 2019/05/17 09:32 by

Was this page helpful?-10+1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki