1gettimeofday(3UCB) SunOS/BSD Compatibility Library Functionsgettimeofday(3UCB)
2
3
4

NAME

6       gettimeofday, settimeofday - get or set the date and time
7

SYNOPSIS

9       /usr/ucb/cc [ flag ... ] file ...
10       #include <sys/time.h>
11
12       int gettimeofday(tp, tzp)
13       struct timeval *tzp;
14       struct timezone *tzp;
15
16
17       int settimeofday(tp, tzp)
18       struct timeval *tzp;
19       struct timezone *tzp;
20
21

DESCRIPTION

23       The  system's notion of the current Greenwich time is obtained with the
24       gettimeofday() call, and set with the settimeofday() call. The  current
25       time  is expressed in elapsed seconds and microseconds since 00:00 GMT,
26       January 1, 1970 (zero hour). The resolution  of  the  system  clock  is
27       hardware  dependent;  the time may be updated continuously, or in clock
28       ticks.
29
30         long tv_sec;      /* seconds since Jan. 1, 1970 */
31         long tv_usec;       /* and microseconds */
32
33
34
35       tp points to a timeval structure, which includes the following members:
36
37
38       If tp is a NULL pointer, the current time information is  not  returned
39       or set.
40
41
42       tzp is an obsolete pointer formerly used to get and set timezone infor‐
43       mation. tzp is now ignored. Timezone information is now  handled  using
44       the TZ environment variable; see TIMEZONE(4).
45
46
47       Only the privileged user may set the time of day.
48

RETURN VALUES

50       A  −1  return  value indicates an error occurred; in this case an error
51       code is stored in the global variable errno.
52

ERRORS

54       The following error codes may be set in errno:
55
56       EINVAL    tp specifies an invalid time.
57
58
59       EPERM     A user other than the privileged user attempted  to  set  the
60                 time.
61
62

SEE ALSO

64       adjtime(2), ctime(3C), gettimeofday(3C), TIMEZONE(4)
65

NOTES

67       Use of these interfaces should be restricted to only applications writ‐
68       ten on BSD platforms.  Use of these interfaces with any of  the  system
69       libraries or in multi-thread applications is unsupported.
70
71
72       tzp is ignored in SunOS 5.X releases.
73
74
75       tv_usec is always 0.
76
77
78
79SunOS 5.11                        30 Oct 2007               gettimeofday(3UCB)
Impressum