1.\" Copyright (c) 1980, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)adjtime.2 8.1 (Berkeley) 06/04/93 7.\" 8.Dd 9.Dt ADJTIME 2 10.Os BSD 4.3 11.Sh NAME 12.Nm adjtime 13.Nd "correct the time to allow synchronization of the system clock" 14.Sh SYNOPSIS 15.Fd #include <sys/time.h> 16.Ft int 17.Fn adjtime "struct timeval *delta" "struct timeval *olddelta" 18.Sh DESCRIPTION 19.Fn Adjtime 20makes small adjustments to the system time, as returned by 21.Xr gettimeofday 2 , 22advancing or retarding it 23by the time specified by the timeval 24.Fa delta . 25If 26.Fa delta 27is negative, the clock is 28slowed down by incrementing it more slowly than normal until 29the correction is complete. 30If 31.Fa delta 32is positive, a larger increment than normal 33is used. 34The skew used to perform the correction is generally a fraction of one percent. 35Thus, the time is always 36a monotonically increasing function. 37A time correction from an earlier call to 38.Fn adjtime 39may not be finished when 40.Fn adjtime 41is called again. 42If 43.Fa olddelta 44is non-nil, 45the structure pointed to will contain, upon return, the 46number of microseconds still to be corrected 47from the earlier call. 48.Pp 49This call may be used by time servers that synchronize the clocks 50of computers in a local area network. 51Such time servers would slow down the clocks of some machines 52and speed up the clocks of others to bring them to the average network time. 53.Pp 54The call 55.Fn adjtime 56is restricted to the super-user. 57.Sh RETURN VALUES 58A return value of 0 indicates that the call succeeded. 59A return value of -1 indicates that an error occurred, and in this 60case an error code is stored in the global variable 61.Va errno . 62.Sh ERRORS 63.Fn Adjtime 64will fail if: 65.Bl -tag -width Er 66.It Bq Er EFAULT 67An argument points outside the process's allocated address space. 68.It Bq Er EPERM 69The process's effective user ID is not that of the super-user. 70.El 71.Sh SEE ALSO 72.Xr date 1 , 73.Xr gettimeofday 2 , 74.Xr timed 8 , 75.Xr timedc 8 , 76.Rs 77.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" 78.%A R. Gusella 79.%A S. Zatti 80.Re 81.Sh HISTORY 82The 83.Nm 84function call appeared in 85.Bx 4.3 . 86