| Current File : //usr/share/man/man2/ntp_gettime.2 |
'\" te
.\" Copyright (c) David L. Mills 1992, 1993, 1994, 1995, 1996, 1997
.\" Portions Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved.
.TH ntp_gettime 2 "21 May 2009" "SunOS 5.11" "System Calls"
.SH NAME
ntp_gettime \- get local clock values
.SH SYNOPSIS
.LP
.nf
#include <sys/timex.h>
\fBint\fR \fBntp_gettime\fR(\fBstruct ntptimeval *\fR\fItptr\fR);
.fi
.SH DESCRIPTION
.sp
.LP
The \fBntp_gettime()\fR function reads the local clock value and dispersion, returning the information in \fItptr\fR.
.sp
.LP
The \fBntptimeval\fR structure contains the following members:
.sp
.in +2
.nf
struct ntptimeval {
struct timeval time; /* current time (ro) */
int32_t maxerror; /* maximum error (us) (ro) */
int32_t esterror; /* estimated error (us) (ro) */
};
.fi
.in -2
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBntp_gettime()\fR returns the current clock state (see <\fBsys/timex.h\fR>). Otherwise, it returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
.SH ERRORS
.sp
.LP
The \fBntp_gettime()\fR function will fail if:
.sp
.ne 2
.mk
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
.rt
The \fItptr\fR argument points to an invalid address.
.RE
.sp
.LP
The \fBntp_gettime()\fR function will fail for 32-bit interfaces if:
.sp
.ne 2
.mk
.na
\fB\fBEOVERFLOW\fR\fR
.ad
.RS 13n
.rt
The size of the \fBtime.tv_sec\fR member of the \fBntptimeval\fR structure pointed to by \fItptr\fR is too small to contain the correct number of seconds.
.RE
.SH SEE ALSO
.sp
.LP
\fBntp_adjtime\fR(2)
.sp
.LP
See the \fBntpd\fR man page, delivered in the \fBSUNWntpu\fR package (not a SunOS man page).