Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ntp_gettime(2) [osf1 man page]

ntp_gettime(2)							System Calls Manual						    ntp_gettime(2)

NAME
ntp_gettime - Gets the date, time, and kernel time error values. SYNOPSIS
#include <sys/timex.h> int ntp_gettime (struct ntptimeval *tp); PARAMETERS
Points to the ntptimeval structure in which information is returned. The ntptimeval structure is described in the sys/timex.h header file. DESCRIPTION
The ntp_gettime() system call returns three read-only values in the ntptimeval structure. The ntptimeval structure members are as follows: The current system time expressed as a Unix timeval structure. The timeval structure consists of two 32-bit words: the first is the number of seconds past 1 January 1970 assuming no intervening leap-second insertions or deletions; and the second is the number of microseconds within the second. The value of the time_maxerror kernel variable, which represents the maximum error of the indicated time relative to the primary synchronization source, in microseconds. For NTP, the value is initialized to the synchronization distance, which is equal to the root dispersion plus one-half the root delay. It is increased by a small amount (time_tolerance) each second to reflect the maximum clock frequency error. This variable is modified by the kernel, but is otherwise not used by the kernel. The value of the time_esterror kernel variable, which represents the expected error of the indicated time relative to the primary synchronization source, in microseconds. For NTP, the value is determined as the root dispersion, which represents the best estimate of the actual error of the system clock based on its past behavior, together with observations of multiple clocks within the peer group. This variable is not used by the kernel. RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
If the ntp_gettime() function fails, errno may be set to one of the following values: The tp parameter points to a location outside of the allocated address space of the process. The kernel was configured without the NTP_TIME option. delim off ntp_gettime(2)

Check Out this Related Man Page

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

NAME
ntp_gettime, ntp_gettimex - get time parameters (NTP daemon interface) SYNOPSIS
#include <sys/timex.h> int ntp_gettime(struct ntptimeval *ntv); int ntp_gettimex(struct ntptimeval *ntv); DESCRIPTION
Both of these APIs return information to the caller via the ntv argument, 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 */ }; maxerror Maximum error, in microseconds. This value can be initialized by ntp_adjtime(3), and is increased periodically (on Linux: each sec- ond), but is clamped to an upper limit (the kernel constant NTP_PHASE_MAX, with a value of 16,000). esterror 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, maxerror, and esterror fields are filled in. ntp_gettimex() performs the same task as ntp_gettime(), but also returns information in the tai field. RETURN VALUE
The return values for ntp_gettime() and ntp_gettimex() are as for adjtimex(2). Given a correct pointer argument, these functions always succeed. VERSIONS
The ntp_gettime() function is available since glibc 2.1. The ntp_gettimex() function is available since glibc 2.12. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +-------------------------------+---------------+---------+ |Interface | Attribute | Value | +-------------------------------+---------------+---------+ |ntp_gettime(), ntp_gettimex() | Thread safety | MT-Safe | +-------------------------------+---------------+---------+ CONFORMING TO
ntp_gettime() is described in the NTP Kernel Application Program Interface. ntp_gettimex() is a GNU extension. SEE ALSO
adjtimex(2) ntp_adjtime(3), time(7) NTP "Kernel Application Program Interface" <http://www.slac.stanford.edu/comp/unix/package/rtems/src/ssrlApps/ntpNanoclock/api.htm> COLOPHON
This page is part of release 4.15 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 https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 NTP_GETTIME(3)
Man Page