1502 Remove conversion cruft from manpages
[unleashed.git] / usr / src / man / man3ucb / gettimeofday.3ucb
blobc4d0c6140912852abca394e6c8f2e0ea433245c9
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
3 .\" Copyright (c) 1980 Regents of the University of California.  All rights reserved.  The Berkeley software License Agreement specifies the terms and conditions for redistribution.
4 .TH GETTIMEOFDAY 3UCB "Oct 30, 2007"
5 .SH NAME
6 gettimeofday, settimeofday \- get or set the date and time
7 .SH SYNOPSIS
8 .LP
9 .nf
10 \fB/usr/ucb/cc\fR [ \fIflag\fR ... ] \fIfile\fR ...
11 #include <sys/time.h>
13 \fBint\fR \fBgettimeofday\fR(\fItp\fR, \fItzp\fR)
14 \fBstruct timeval *\fR\fItzp\fR;
15 \fBstruct timezone *\fR\fItzp\fR;
16 .fi
18 .LP
19 .nf
20 \fBint\fR \fBsettimeofday\fR(\fItp\fR, \fItzp\fR)
21 \fBstruct timeval *\fR\fItzp\fR;
22 \fBstruct timezone *\fR\fItzp\fR;
23 .fi
25 .SH DESCRIPTION
26 .sp
27 .LP
28 The system's notion of the current Greenwich time is obtained with the
29 \fBgettimeofday()\fR call, and set with the \fBsettimeofday()\fR call. The
30 current time is expressed in elapsed seconds and microseconds since 00:00
31 \fBGMT,\fR January 1, 1970 (zero hour). The resolution of the system clock is
32 hardware dependent; the time may be updated continuously, or in clock ticks.
33 .sp
34 .in +2
35 .nf
36 long    tv_sec;    /* seconds since Jan. 1, 1970 */
37 long    tv_usec;        /* and microseconds */
38 .fi
39 .in -2
41 .sp
42 .LP
43 \fItp\fR points to a \fBtimeval\fR structure, which includes the following
44 members:
45 .sp
46 .LP
47 If \fItp\fR is a \fINULL\fR pointer, the current time information is not
48 returned or set.
49 .sp
50 .LP
51 \fItzp\fR is an obsolete pointer formerly used to get and set timezone
52 information. \fItzp\fR is now ignored. Timezone information is now handled
53 using the \fBTZ\fR environment variable; see \fBTIMEZONE\fR(4).
54 .sp
55 .LP
56 Only the privileged user may set the time of day.
57 .SH RETURN VALUES
58 .sp
59 .LP
60 A \fB\(mi1\fR return value indicates an error occurred; in this case an error
61 code is stored in the global variable \fBerrno\fR.
62 .SH ERRORS
63 .sp
64 .LP
65 The following error codes may be set in \fBerrno\fR:
66 .sp
67 .ne 2
68 .na
69 \fB\fBEINVAL\fR\fR
70 .ad
71 .RS 10n
72 \fItp\fR specifies an invalid time.
73 .RE
75 .sp
76 .ne 2
77 .na
78 \fB\fBEPERM\fR\fR
79 .ad
80 .RS 10n
81 A user other than the privileged user attempted to set the time.
82 .RE
84 .SH SEE ALSO
85 .sp
86 .LP
87 \fBadjtime\fR(2), \fBctime\fR(3C), \fBgettimeofday\fR(3C), \fBTIMEZONE\fR(4)
88 .SH NOTES
89 .sp
90 .LP
91 Use of these interfaces should be restricted to only applications written on
92 BSD platforms.  Use of these interfaces with any of the system libraries or in
93 multi-thread applications is unsupported.
94 .sp
95 .LP
96 \fItzp\fR is ignored in SunOS 5.\fIX\fR releases.
97 .sp
98 .LP
99 \fBtv_usec\fR is always 0.