
ADJTIME(2)                 UNIX Programmer's Manual                 ADJTIME(2)

NNAAMMEE
     aaddjjttiimmee - correct the time to allow synchronization of the system clock

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<ssyyss//ttiimmee..hh>>

     _i_n_t
     aaddjjttiimmee(_s_t_r_u_c_t _t_i_m_e_v_a_l _*_d_e_l_t_a, _s_t_r_u_c_t _t_i_m_e_v_a_l _*_o_l_d_d_e_l_t_a)

DDEESSCCRRIIPPTTIIOONN
     AAddjjttiimmee() makes small adjustments to the system time, as returned by
     gettimeofday(2),  advancing or retarding it by the time specified by the
     timeval _d_e_l_t_a. If _d_e_l_t_a is negative, the clock is slowed down by incre-
     menting it more slowly than normal until the correction is complete.  If
     _d_e_l_t_a is positive, a larger increment than normal is used.  The skew used
     to perform the correction is generally a fraction of one percent.  Thus,
     the time is always a monotonically increasing function.  A time correc-
     tion from an earlier call to aaddjjttiimmee() may not be finished when aaddjjttiimmee()
     is called again.  If _o_l_d_d_e_l_t_a is non-nil, the structure pointed to will
     contain, upon return, the number of microseconds still to be corrected
     from the earlier call.

     This call may be used by time servers that synchronize the clocks of com-
     puters in a local area network.  Such time servers would slow down the
     clocks of some machines and speed up the clocks of others to bring them
     to the average network time.

     The call aaddjjttiimmee() is restricted to the super-user.

RREETTUURRNN VVAALLUUEESS
     A return value of 0 indicates that the call succeeded.  A return value of
     -1 indicates that an error occurred, and in this case an error code is
     stored in the global variable _e_r_r_n_o.

EERRRROORRSS
     AAddjjttiimmee() will fail if:

     [EFAULT]      An argument points outside the process's allocated address
                   space.

     [EPERM]       The process's effective user ID is not that of the super-
                   user.

SSEEEE AALLSSOO
     date(1),  gettimeofday(2),  timed(8),  timedc(8),

     R. Gusella, and S. Zatti, _T_S_P_: _T_h_e _T_i_m_e _S_y_n_c_h_r_o_n_i_z_a_t_i_o_n _P_r_o_t_o_c_o_l _f_o_r _U_N_I_X
     _4_._3_B_S_D.

HHIISSTTOORRYY
     The aaddjjttiimmee function call appeared in 4.3BSD.

4.3 Berkeley Distribution       March 10, 1991                               1










