1 .\" Copyright (c) 1980, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95
41 .Nd get/set date and time
47 .Fn gettimeofday "struct timeval *tp" "struct timezone *tzp"
49 .Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp"
52 Note: timezone is no longer used; this information is kept outside
56 The system's notion of the current Greenwich time and the current time
57 zone is obtained with the
59 call, and set with the
61 call. The time is expressed in seconds and microseconds
62 since midnight (0 hour), January 1, 1970. The resolution of the system
63 clock is hardware dependent, and the time may be updated continuously or
70 is NULL, the associated time
71 information will not be returned or set.
73 The structures pointed to by
83 long tv_sec; /* seconds since Jan. 1, 1970 */
84 long tv_usec; /* and microseconds */
88 int tz_minuteswest; /* minutes west of Greenwich */
89 int tz_dsttime; /* type of dst correction */
95 structure indicates the local time zone
96 (measured in minutes of time westward from Greenwich),
97 and a flag that, if nonzero, indicates that
98 Daylight Saving time applies locally during
99 the appropriate part of the year.
101 Only the super-user may set the time of day or time zone.
102 If the system is running in secure mode (see
104 the time may only be advanced.
105 This limitation is imposed to prevent a malicious super-user
106 from setting arbitrary time stamps on files.
107 The system time can still be adjusted backwards using the
109 system call even when the system is secure.
113 The following error codes may be set in
117 An argument address referenced invalid memory.
119 A user other than the super-user attempted to set the time.
131 function call appeared in