*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> ntp_adjtime (2)              
Title
Content
Arch
Section
 

NTP_ADJTIME(2)

Contents


NAME    [Toc]    [Back]

     ntp_adjtime -- NTP daemon application interface

SYNOPSIS    [Toc]    [Back]

     #include <sys/types.h>
     #include <sys/timex.h>

     int
     ntp_adjtime(struct timex *tp);

DESCRIPTION    [Toc]    [Back]

     The ntp_adjtime() system call is used as a kernel interface for the Network
 Time Protocol daemon, ntpd(8).  Certain fields of the timex structure
 are interpreted in either microseconds or nanoseconds, according to
     the state of the STA_NANO bit in the status word.

     In the FreeBSD kernel, the ntp_adjtime() and ntp_gettime(2) system calls
     can be used to determine which resolution is in use, and to select either
     one at any time.  The resolution selected affects the scaling of certain
     fields in the ntp_gettime() and ntp_adjtime() system calls.

     Take note that this API is extremely complex and stateful.  Users should
     not attempt modification without first reviewing the ntpd(8) sources in
     depth.

     /*
      * NTP daemon interface (ntp_adjtime()) - used to discipline CPU clock
      * oscillator and determine status.
      *
      * Note: The offset, precision and jitter members are in microseconds if
      * STA_NANO is zero and nanoseconds if not.
      */
     struct timex {
	     unsigned int modes;     /* clock mode bits (wo) */
	     long    offset;	     /* time offset (ns/us) (rw) */
	     long    freq;	     /* frequency offset (scaled PPM) (rw) */
	     long    maxerror;	     /* maximum error (us) (rw) */
	     long    esterror;	     /* estimated error (us) (rw) */
	     int     status;	     /* clock status bits (rw) */
	     long    constant;	     /* poll interval (log2 s) (rw) */
	     long    precision;      /* clock precision (ns/us) (ro) */
	     long    tolerance;      /* clock frequency tolerance (scaled
				      * PPM) (ro) */
	     /*
	      * The following read-only structure members are implemented
	      * only if the PPS signal discipline is configured in the
	      * kernel. They are included in all configurations to insure
	      * portability.
	      */
	     long    ppsfreq;	     /* PPS frequency (scaled PPM) (ro) */
	     long    jitter;	     /* PPS jitter (ns/us) (ro) */
	     int     shift;	     /* interval duration (s) (shift) (ro) */
	     long    stabil;	     /* PPS stability (scaled PPM) (ro) */
	     long    jitcnt;	     /* jitter limit exceeded (ro) */
	     long    calcnt;	     /* calibration intervals (ro) */
	     long    errcnt;	     /* calibration errors (ro) */
	     long    stbcnt;	     /* stability limit exceeded (ro) */
     };

     Upon successful completion, ntp_adjtime() will fill the tp argument with
     the current clock state.

RETURN VALUES    [Toc]    [Back]

     Upon successful completion the clock state is returned.  Otherwise a -1
     is returned and the global variable errno is set to indicate the error.

     Possible states of the clock are:

     TIME_OK	 Everything okay, no leap second warning.
     TIME_INS	 insert leap second warning.
     TIME_DEL	 delete leap second warning.
     TIME_OOP	 Leap second in progress.
     TIME_WAIT	 Leap second has occurred.
     TIME_ERROR  Clock not synchronized.

ERRORS    [Toc]    [Back]

     The ntp_gettime() system call may return EPERM if the caller does not
     have sufficient permissions.

SEE ALSO    [Toc]    [Back]

      
      
     ntp_gettime(2), ntpd(8)

AUTHORS    [Toc]    [Back]

     This manual page was written by Tom Rhodes <trhodes@FreeBSD.org>.


FreeBSD 5.2.1			 April 1, 2003			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
ntp_gettime FreeBSD NTP user application interface
abi IRIX Application Binary Interface
smapi FreeBSD System Management Application Program Interface driver
gssapi HP-UX Generic Security Service Application Programming Interface
ns_lookup IRIX lookup interface to name service daemon
nfsservctl Linux syscall interface to kernel nfs daemon
atmarpd FreeBSD ATMARP/SCSP interface daemon
gss_krb5_copy_ccache FreeBSD Generic Security Service Application Program Interface library
gss_release_buffer FreeBSD Generic Security Service Application Program Interface library
gss_process_context_token FreeBSD Generic Security Service Application Program Interface library
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service