1.\" $OpenBSD: adjtime.2,v 1.13 2003/06/02 20:18:38 millert Exp $ 2.\" $NetBSD: adjtime.2,v 1.5 1995/10/12 15:40:44 jtc Exp $ 3.\" 4.\" Copyright (c) 1980, 1991, 1993 5.\" The Regents of the University of California. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. Neither the name of the University nor the names of its contributors 16.\" may be used to endorse or promote products derived from this software 17.\" without specific prior written permission. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29.\" SUCH DAMAGE. 30.\" 31.\" @(#)adjtime.2 8.1 (Berkeley) 6/4/93 32.\" 33.Dd June 4, 1993 34.Dt ADJTIME 2 35.Os 36.Sh NAME 37.Nm adjtime 38.Nd "correct the time to allow synchronization of the system clock" 39.Sh SYNOPSIS 40.Fd #include <sys/time.h> 41.Ft int 42.Fn adjtime "const struct timeval *delta" "struct timeval *olddelta" 43.Sh DESCRIPTION 44.Fn adjtime 45makes small adjustments to the system time, as returned by 46.Xr gettimeofday 2 , 47advancing or retarding it by the time specified by the timeval 48.Fa delta . 49If 50.Fa delta 51is negative, the clock is slowed down by incrementing it more slowly 52than normal until the correction is complete. 53If 54.Fa delta 55is positive, a larger increment than normal is used. 56The skew used to perform the correction is generally a fraction of one percent. 57Thus, the time is always a monotonically increasing function. 58A time correction from an earlier call to 59.Fn adjtime 60may not be finished when 61.Fn adjtime 62is called again. 63If 64.Fa olddelta 65is non-null, the structure pointed to will contain, upon return, the 66number of microseconds still to be corrected from the earlier call. 67.Pp 68This call may be used by time servers that synchronize the clocks 69of computers in a local area network. 70Such time servers would slow down the clocks of some machines 71and speed up the clocks of others to bring them to the average network time. 72.Pp 73The call 74.Fn adjtime 75is restricted to the superuser. 76.Sh RETURN VALUES 77A return value of 0 indicates that the call succeeded. 78A return value of \-1 indicates that an error occurred, and in this 79case an error code is stored in the global variable 80.Va errno . 81.Sh ERRORS 82.Fn adjtime 83will fail if: 84.Bl -tag -width Er 85.It Bq Er EFAULT 86Either of the arguments point outside the process's allocated address space. 87.It Bq Er EPERM 88The process's effective user ID is not that of the superuser. 89.El 90.Sh SEE ALSO 91.Xr date 1 , 92.Xr gettimeofday 2 , 93.Xr timed 8 , 94.Xr timedc 8 95.Rs 96.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" 97.%A R. Gusella 98.%A S. Zatti 99.Re 100.Sh HISTORY 101The 102.Fn adjtime 103function call appeared in 104.Bx 4.3 . 105