|
|
1.1 root 1: .TH GETTIMEOFDAY 2 "27 July 1983"
2: .UC 4
3: .SH NAME
4: gettimeofday, settimeofday \- get/set date and time
5: .SH SYNOPSIS
6: .nf
7: .ft B
8: #include <sys/time.h>
9: .PP
10: .ft B
11: gettimeofday(tp, tzp)
12: struct timeval *tp;
13: struct timezone *tzp;
14: .PP
15: .ft B
16: settimeofday(tp, tzp)
17: struct timeval *tp;
18: struct timezone *tzp;
19: .fi
20: .SH DESCRIPTION
21: .I Gettimeofday
22: returns the system's notion of the current Greenwich time and
23: the current time zone. Time returned is expressed relative
24: in seconds and microseconds since midnight January 1, 1970.
25: .PP
26: The structures pointed to by
27: .I tp
28: and
29: .I tzp
30: are defined in
31: .I <sys/time.h>
32: as:
33: .PP
34: .nf
35: .RS
36: .DT
37: struct timeval {
38: u_long tv_sec; /* seconds since Jan. 1, 1970 */
39: long tv_usec; /* and microseconds */
40: };
41: .sp 1
42: struct timezone {
43: int tz_minuteswest; /* of Greenwich */
44: int tz_dsttime; /* type of dst correction to apply */
45: };
46: .RE
47: .fi
48: .PP
49: The
50: .I timezone
51: structure indicates the local time zone
52: (measured in minutes of time westward from Greenwich),
53: and a flag that, if nonzero, indicates that
54: Daylight Saving time applies locally during
55: the appropriate part of the year.
56: .PP
57: Only the super-user may set the time of day.
58: .SH RETURN
59: A 0 return value indicates that the call succeeded.
60: A \-1 return value indicates an error occurred, and in this
61: case an error code is stored into the global variable \fIerrno\fP.
62: .SH "ERRORS
63: The following error codes may be set in \fIerrno\fP:
64: .TP 15
65: [EFAULT]
66: An argument address referenced invalid memory.
67: .TP 15
68: [EPERM]
69: A user other than the super-user attempted to set the time.
70: .SH "SEE ALSO"
71: date(1), ctime(3)
72: .SH BUGS
73: Time is never correct enough to believe the microsecond
1.1.1.2 ! root 74: values. There should be a mechanism by which, at least,
1.1 root 75: local clusters of systems might synchronize their clocks
76: to millisecond granularity.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.