1adjtime(2)                       System Calls                       adjtime(2)
2
3
4

NAME

6       adjtime - correct the time to allow synchronization of the system clock
7

SYNOPSIS

9       #include <sys/time.h>
10
11       int adjtime(struct timeval *delta, struct timeval *olddelta);
12
13

DESCRIPTION

15       The  adjtime() function adjusts the system's notion of the current time
16       as returned by gettimeofday(3C),  advancing  or  retarding  it  by  the
17       amount of time specified in the struct timeval pointed to by delta.
18
19
20       The  adjustment  is  effected by speeding up (if that amount of time is
21       positive) or slowing down (if that amount of time is negative) the sys‐
22       tem's  clock by some small percentage, generally a fraction of one per‐
23       cent. The time is always a monotonically increasing  function.  A  time
24       correction  from  an earlier call to adjtime() may not be finished when
25       adjtime() is called again.
26
27
28       If delta is 0, then olddelta returns the status of the effects  of  the
29       previous  adjtime()  call  with  no  effect on the time correction as a
30       result of this call. If olddelta is not a null pointer, then the struc‐
31       ture  it  points to will contain, upon successful return, the number of
32       seconds and/or microseconds still to  be  corrected  from  the  earlier
33       call. If olddelta is a null pointer, the corresponding information will
34       not be returned.
35
36
37       This call may be used in time servers that synchronize  the  clocks  of
38       computers  in  a  local area network. Such time servers would slow down
39       the clocks of some machines and speed up the clocks of others to  bring
40       them to the average network time.
41
42
43       Only  a  processes  with  appropriate privileges can adjust the time of
44       day.
45
46
47       The adjustment value will be silently rounded to the resolution of  the
48       system clock.
49

RETURN VALUES

51       Upon  successful completion, adjtime() returns 0. Otherwise, it returns
52       −1 and sets errno to indicate the error.
53

ERRORS

55       The adjtime() function will fail if:
56
57       EFAULT    The delta or olddelta argument points outside  the  process's
58                 allocated  address  space,  or olddelta points to a region of
59                 the process's allocated address space that is not writable.
60
61
62       EINVAL    The tv_usec  member  of  delta  is  not  within  valid  range
63                 (−1000000 to 1000000).
64
65
66       EPERM     The  {PRIV_SYS_TIME}  privilege is not asserted in the effec‐
67                 tive set of the calling process.
68
69
70
71       Additionally, the adjtime() function will fail  for  32-bit  interfaces
72       if:
73
74       EOVERFLOW    The  size  of  the  tv_sec member of the timeval structure
75                    pointed to by olddelta is too small to contain the correct
76                    number of seconds.
77
78

SEE ALSO

80       date(1), gettimeofday(3C), privileges(5)
81
82
83
84SunOS 5.11                        20 Jan 2003                       adjtime(2)
Impressum