From 9aba79052e570949849c1985ff95ff264ff272ec Mon Sep 17 00:00:00 2001 From: trhodes Date: Thu, 17 Apr 2003 18:39:30 +0000 Subject: Add a manual page for the ntp_gettime syscall. Reviewed by: ru, phk (older version). --- lib/libc/sys/Makefile.inc | 4 +- lib/libc/sys/ntp_gettime.2 | 104 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 lib/libc/sys/ntp_gettime.2 (limited to 'lib') diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index fc9ff7d..0c53319 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -70,8 +70,8 @@ MAN+= _exit.2 accept.2 access.2 acct.2 adjtime.2 \ kldunload.2 kqueue.2 kse.2 ktrace.2 link.2 lio_listio.2 listen.2 \ lseek.2 \ madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 mmap.2 \ - modfind.2 modnext.2 modstat.2 \ - mount.2 mprotect.2 msync.2 munmap.2 nanosleep.2 ntp_adjtime.2 \ + modfind.2 modnext.2 modstat.2 mount.2 \ + mprotect.2 msync.2 munmap.2 nanosleep.2 ntp_adjtime.2 ntp_gettime.2 \ nfssvc.2 open.2 pathconf.2 pipe.2 poll.2 profil.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ rtprio.2 select.2 semctl.2 semget.2 semop.2 send.2 sendfile.2 \ diff --git a/lib/libc/sys/ntp_gettime.2 b/lib/libc/sys/ntp_gettime.2 new file mode 100644 index 0000000..7de0fed --- /dev/null +++ b/lib/libc/sys/ntp_gettime.2 @@ -0,0 +1,104 @@ +.\" +.\" Copyright (c) 2003 Tom Rhodes +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 1, 2003 +.Dt NTP_GETTIME 2 +.Os +.Sh NAME +.Nm ntp_gettime +.Nd NTP user application interface +.Sh SYNOPSIS +.In sys/timex.h +.Ft int +.Fn ntp_gettime "struct ntptimeval *ntv" +.Sh DESCRIPTION +The time returned by +.Fn ntp_gettime +is in a +.Vt timespec +structure, but may be in either microsecond +(seconds and microseconds) or nanosecond (seconds and nanoseconds) format. +The particular format in use is determined by the +.Dv STA_NANO +bit of the status +word returned by the +.Fn ntp_adjtime +system call. +.Fn ntp_gettime +has as argument a pointer to the +.Vt ntptimeval +structure with the following members: +.Bd -literal +struct ntptimeval { + struct timespec time; /* current time (ns) (ro) */ + long maxerror; /* maximum error (us) (ro) */ + long esterror; /* estimated error (us) (ro) */ + long tai; /* TAI offset */ + int time_state; /* time status */ +}; +.Ed +.Pp +These are understood as: +.Bl -tag -width ".Va time_state" +.It Va time +Current time (read-only). +.It Va maxerror +Maximum error in microseconds (read-only). +.It Va esterror +Estimated error in microseconds (read-only). +.It Va tai +Temps Atomique International (French for International Atomic Time), +measures real time. +Used for acute time measurements. +.It Va time_state +Current time status. +.El +.Sh RETURN VALUES +.Rv -std ntp_gettime +.Pp +Possible states of the clock are: +.Pp +.Bl -tag -compact -width ".Dv TIME_ERROR" +.It Dv TIME_OK +Everything okay, no leap second warning. +.It Dv TIME_INS +Insert leap second warning. +.It Dv TIME_DEL +Delete leap second warning. +.It Dv TIME_OOP +Leap second in progress. +.It Dv TIME_WAIT +Leap second has occurred. +.It Dv TIME_ERROR +Clock not synchronized. +.El +.Sh SEE ALSO +.Xr ntp_adjtime 2 , +.Xr ntpd 8 +.Sh AUTHORS +This manual page was written by +.An Tom Rhodes Aq trhodes@FreeBSD.org . -- cgit v1.1