2016-03-06 22:33:01 +00:00
|
|
|
.\" Copyright (c) 2016 by Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
|
|
|
.\" %%%LICENSE_START(VERBATIM)
|
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
|
|
|
.\" %%%LICENSE_END
|
|
|
|
.\"
|
memusage.1, memusagestat.1, pldd.1, accept.2, adjtimex.2, arch_prctl.2, bdflush.2, bpf.2, close.2, epoll_ctl.2, epoll_wait.2, execve.2, execveat.2, fanotify_init.2, fanotify_mark.2, fcntl.2, fsync.2, get_kernel_syms.2, getdomainname.2, getgroups.2, gethostname.2, getrandom.2, getrlimit.2, getrusage.2, getsid.2, getunwind.2, io_getevents.2, ioctl_fat.2, kexec_load.2, killpg.2, listxattr.2, lseek.2, madvise.2, memfd_create.2, mknod.2, mlock.2, modify_ldt.2, msgctl.2, msgget.2, msgop.2, readlink.2, readv.2, reboot.2, recvmmsg.2, rename.2, request_key.2, restart_syscall.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, seccomp.2, select_tut.2, semctl.2, semget.2, semop.2, set_thread_area.2, seteuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, shmctl.2, shmget.2, shmop.2, sigaction.2, sigprocmask.2, stat.2, symlink.2, syscall.2, sysctl.2, unlink.2, bindresvport.3, byteorder.3, dlopen.3, endian.3, error.3, ffs.3, fmemopen.3, getcwd.3, getlogin.3, getnetent.3, getprotoent.3, getservent.3, getumask.3, getutent.3, glob.3, isalpha.3, lio_listio.3, login.3, mbsinit.3, mbstowcs.3, mbtowc.3, mkstemp.3, nextup.3, ntp_gettime.3, posix_fallocate.3, posix_spawn.3, pthread_join.3, pthread_rwlockattr_setkind_np.3, random.3, rcmd.3, realpath.3, resolver.3, setjmp.3, setnetgrent.3, sigvec.3, strerror.3, strverscmp.3, system.3, toupper.3, towlower.3, towupper.3, wcstombs.3, wordexp.3, cciss.4, loop.4, mouse.4, random.4, core.5, group.5, hosts.5, resolv.conf.5, ascii.7, environ.7, epoll.7, glob.7, ip.7, mq_overview.7, packet.7, pipe.7, raw.7, sched.7, signal.7, socket.7, symlink.7, ld.so.8, sln.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-10-08 10:53:47 +00:00
|
|
|
.TH NTP_GETTIME 3 2016-10-08 "Linux" "Linux Programmer's Manual"
|
2016-03-06 22:33:01 +00:00
|
|
|
.SH NAME
|
|
|
|
ntp_gettime, ntp_gettimex \- get time parameters (NTP daemon interface)
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <sys/timex.h>
|
_syscall.2, clock_getres.2, clone.2, copy_file_range.2, create_module.2, delete_module.2, fallocate.2, futex.2, get_kernel_syms.2, get_robust_list.2, getcpu.2, getdents.2, gettid.2, gettimeofday.2, getunwind.2, init_module.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl_userfaultfd.2, ioprio_set.2, kcmp.2, kexec_load.2, keyctl.2, link.2, llseek.2, memfd_create.2, mmap.2, mq_getsetattr.2, msgctl.2, msgget.2, open_by_handle_at.2, outb.2, perf_event_open.2, pivot_root.2, process_vm_readv.2, query_module.2, readdir.2, recvmmsg.2, rename.2, request_key.2, restart_syscall.2, rt_sigqueueinfo.2, s390_pci_mmio_write.2, s390_runtime_instr.2, sched_setattr.2, seccomp.2, select.2, select_tut.2, send.2, sendmmsg.2, set_thread_area.2, set_tid_address.2, sgetmask.2, shmop.2, sigaction.2, sigprocmask.2, splice.2, spu_create.2, spu_run.2, statx.2, subpage_prot.2, sync_file_range.2, syscall.2, sysctl.2, sysfs.2, tee.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, tkill.2, uselib.2, utimensat.2, vmsplice.2, wait.2, aio_init.3, asinh.3, atan2.3, atanh.3, backtrace.3, basename.3, bswap.3, bzero.3, catgets.3, catopen.3, dladdr.3, dlsym.3, endian.3, envz_add.3, erf.3, erfc.3, error.3, ferror.3, ffs.3, fgetc.3, fmemopen.3, fopen.3, fopencookie.3, fseek.3, ftw.3, futimes.3, getdate.3, getenv.3, getline.3, getlogin.3, getrpcent.3, getsubopt.3, getutmp.3, getw.3, gnu_get_libc_version.3, inet_net_pton.3, isalpha.3, lio_listio.3, makedev.3, malloc_get_state.3, malloc_stats.3, malloc_trim.3, malloc_usable_size.3, matherr.3, memchr.3, nextup.3, ntp_gettime.3, posix_madvise.3, program_invocation_name.3, pthread_atfork.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cleanup_push_defer_np.3, pthread_detach.3, pthread_equal.3, pthread_exit.3, pthread_join.3, pthread_kill.3, pthread_kill_other_threads_np.3, pthread_rwlockattr_setkind_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedprio.3, pthread_testcancel.3, pthread_tryjoin_np.3, pthread_yield.3, puts.3, random.3, random_r.3, rpc.3, sched_getcpu.3, setnetgrent.3, sigwait.3, stdin.3, strerror.3, strfmon.3, timeradd.3, tmpnam.3, toupper.3, towlower.3, towupper.3, ttyname.3, uselocale.3, xdr.3, dsp56k.4, sigevent.7, vdso.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-15 17:26:11 +00:00
|
|
|
.PP
|
2016-03-06 22:33:01 +00:00
|
|
|
.BI "int ntp_gettime(struct ntptimeval *" ntv );
|
_syscall.2, clock_getres.2, clone.2, copy_file_range.2, create_module.2, delete_module.2, fallocate.2, futex.2, get_kernel_syms.2, get_robust_list.2, getcpu.2, getdents.2, gettid.2, gettimeofday.2, getunwind.2, init_module.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl_userfaultfd.2, ioprio_set.2, kcmp.2, kexec_load.2, keyctl.2, link.2, llseek.2, memfd_create.2, mmap.2, mq_getsetattr.2, msgctl.2, msgget.2, open_by_handle_at.2, outb.2, perf_event_open.2, pivot_root.2, process_vm_readv.2, query_module.2, readdir.2, recvmmsg.2, rename.2, request_key.2, restart_syscall.2, rt_sigqueueinfo.2, s390_pci_mmio_write.2, s390_runtime_instr.2, sched_setattr.2, seccomp.2, select.2, select_tut.2, send.2, sendmmsg.2, set_thread_area.2, set_tid_address.2, sgetmask.2, shmop.2, sigaction.2, sigprocmask.2, splice.2, spu_create.2, spu_run.2, statx.2, subpage_prot.2, sync_file_range.2, syscall.2, sysctl.2, sysfs.2, tee.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, tkill.2, uselib.2, utimensat.2, vmsplice.2, wait.2, aio_init.3, asinh.3, atan2.3, atanh.3, backtrace.3, basename.3, bswap.3, bzero.3, catgets.3, catopen.3, dladdr.3, dlsym.3, endian.3, envz_add.3, erf.3, erfc.3, error.3, ferror.3, ffs.3, fgetc.3, fmemopen.3, fopen.3, fopencookie.3, fseek.3, ftw.3, futimes.3, getdate.3, getenv.3, getline.3, getlogin.3, getrpcent.3, getsubopt.3, getutmp.3, getw.3, gnu_get_libc_version.3, inet_net_pton.3, isalpha.3, lio_listio.3, makedev.3, malloc_get_state.3, malloc_stats.3, malloc_trim.3, malloc_usable_size.3, matherr.3, memchr.3, nextup.3, ntp_gettime.3, posix_madvise.3, program_invocation_name.3, pthread_atfork.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cleanup_push_defer_np.3, pthread_detach.3, pthread_equal.3, pthread_exit.3, pthread_join.3, pthread_kill.3, pthread_kill_other_threads_np.3, pthread_rwlockattr_setkind_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setschedprio.3, pthread_testcancel.3, pthread_tryjoin_np.3, pthread_yield.3, puts.3, random.3, random_r.3, rpc.3, sched_getcpu.3, setnetgrent.3, sigwait.3, stdin.3, strerror.3, strfmon.3, timeradd.3, tmpnam.3, toupper.3, towlower.3, towupper.3, ttyname.3, uselocale.3, xdr.3, dsp56k.4, sigevent.7, vdso.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-08-15 17:26:11 +00:00
|
|
|
.PP
|
2016-03-06 22:33:01 +00:00
|
|
|
.BI "int ntp_gettimex(struct ntptimeval *" ntv );
|
|
|
|
.fi
|
|
|
|
.SH DESCRIPTION
|
|
|
|
Both of these APIs return information to the caller via the
|
|
|
|
.I ntv
|
|
|
|
argument, a structure of the following type:
|
|
|
|
|
|
|
|
.in +4n
|
|
|
|
.nf
|
|
|
|
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 */
|
|
|
|
};
|
|
|
|
.fi
|
|
|
|
.in
|
|
|
|
|
|
|
|
The fields of this structure are as follows:
|
|
|
|
.TP
|
|
|
|
.I time
|
|
|
|
The current time, expressed as a
|
|
|
|
.I timeval
|
|
|
|
structure:
|
|
|
|
|
|
|
|
.in +4n
|
|
|
|
.nf
|
|
|
|
struct timeval {
|
|
|
|
time_t tv_sec; /* Seconds since the Epoch */
|
|
|
|
suseconds_t tv_usec; /* Microseconds */
|
|
|
|
};
|
|
|
|
|
|
|
|
.fi
|
|
|
|
.in
|
|
|
|
.TP
|
|
|
|
.I maxerror
|
|
|
|
Maximum error, in microseconds.
|
2016-03-07 01:42:41 +00:00
|
|
|
This value can be initialized by
|
2016-03-06 22:33:01 +00:00
|
|
|
.BR ntp_adjtime (3),
|
|
|
|
and is increased periodically (on Linux: each second),
|
|
|
|
but is clamped to an upper limit (the kernel constant
|
|
|
|
.BR NTP_PHASE_MAX ,
|
|
|
|
with a value of 16,000).
|
|
|
|
.TP
|
|
|
|
.I esterror
|
|
|
|
Estimated error, in microseconds.
|
|
|
|
This value can be set via
|
|
|
|
.BR 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.
|
|
|
|
.TP
|
|
|
|
.I tai
|
|
|
|
TAI (Atomic International Time) offset.
|
|
|
|
.PP
|
|
|
|
.BR ntp_gettime ()
|
|
|
|
returns an
|
|
|
|
.I ntptimeval
|
|
|
|
structure in which the
|
|
|
|
.IR time ,
|
|
|
|
.IR maxerror ,
|
|
|
|
and
|
|
|
|
.IR esterror
|
|
|
|
fields are filled in.
|
|
|
|
.PP
|
|
|
|
.BR ntp_gettimex ()
|
|
|
|
performs the same task as
|
|
|
|
.BR ntp_gettime (),
|
|
|
|
but also returns information in the
|
|
|
|
.I tai
|
|
|
|
field.
|
|
|
|
.SH RETURN VALUE
|
|
|
|
The return values for
|
|
|
|
.BR ntp_gettime ()
|
|
|
|
and
|
|
|
|
.BR ntp_gettimex ()
|
|
|
|
are as for
|
|
|
|
.BR adjtimex (2).
|
2016-03-07 01:42:41 +00:00
|
|
|
Given a correct pointer argument, these functions always succeed.
|
2016-03-06 22:33:01 +00:00
|
|
|
.\" FIXME . the info page incorrectly describes the return values.
|
2016-08-07 19:16:12 +00:00
|
|
|
.SH VERSIONS
|
|
|
|
The
|
|
|
|
.BR ntp_gettime ()
|
|
|
|
function is available since glibc 2.1.
|
|
|
|
The
|
|
|
|
.BR ntp_gettimex ()
|
|
|
|
function is available since glibc 2.12.
|
2016-03-07 01:48:38 +00:00
|
|
|
.SH ATTRIBUTES
|
|
|
|
For an explanation of the terms used in this section, see
|
|
|
|
.BR attributes (7).
|
|
|
|
.TS
|
|
|
|
allbox;
|
|
|
|
lbw30 lb lb
|
|
|
|
l l l.
|
|
|
|
Interface Attribute Value
|
|
|
|
T{
|
|
|
|
.BR ntp_gettime (),
|
|
|
|
.BR ntp_gettimex ()
|
|
|
|
T} Thread safety MT-Safe
|
|
|
|
.TE
|
2016-03-06 22:33:01 +00:00
|
|
|
.SH CONFORMING TO
|
|
|
|
.BR ntp_gettime ()
|
|
|
|
is described in the NTP Kernel Application Program Interface.
|
|
|
|
.BR ntp_gettimex ()
|
|
|
|
is a GNU extension.
|
|
|
|
.SH SEE ALSO
|
|
|
|
.BR adjtimex (2)
|
|
|
|
.BR ntp_adjtime (3),
|
|
|
|
.BR time (7)
|
|
|
|
|
|
|
|
.ad l
|
|
|
|
.UR http://www.slac.stanford.edu/comp/unix/\:package/\:rtems/\:src/\:ssrlApps/\:ntpNanoclock/\:api.htm
|
|
|
|
NTP "Kernel Application Program Interface"
|
|
|
|
.UE
|