xref: /titanic_51/usr/src/man/man2/ntp_gettime.2 (revision 6e6df3cf62ece86f43c1a3218dc4b7797d9ce731)
te
Copyright (c) David L. Mills 1992, 1993, 1994, 1995, 1996, 1997
Portions Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
NTP_GETTIME 2 "May 21, 2009"
NAME
ntp_gettime - get local clock values
SYNOPSIS

#include <sys/timex.h>

int ntp_gettime(struct ntptimeval *tptr);
DESCRIPTION

The ntp_gettime() function reads the local clock value and dispersion, returning the information in tptr.

The ntptimeval structure contains the following members:

struct ntptimeval {
 struct timeval time; /* current time (ro) */
 int32_t maxerror; /* maximum error (us) (ro) */
 int32_t esterror; /* estimated error (us) (ro) */
};
RETURN VALUES

Upon successful completion, ntp_gettime() returns the current clock state (see <sys/timex.h>). Otherwise, it returns -1 and sets errno to indicate the error.

ERRORS

The ntp_gettime() function will fail if: EFAULT

The tptr argument points to an invalid address.

The ntp_gettime() function will fail for 32-bit interfaces if: EOVERFLOW

The size of the time.tv_sec member of the ntptimeval structure pointed to by tptr is too small to contain the correct number of seconds.

SEE ALSO

ntp_adjtime(2)

See the ntpd man page, delivered in the SUNWntpu package (not a SunOS man page).