.\"
.\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95
.\"
-.Dd May 26, 1995
+.Dd August 5, 2008
.Dt GETTIMEOFDAY 2
.Os BSD 4
.Sh NAME
.Fa "const struct timezone *tzp"
.Fc
.Sh DESCRIPTION
-.Bf -symbolic
-Note: timezone is no longer used; this information is kept outside
-the kernel.
-.Ef
.Pp
The system's notion of the current Greenwich time and the current time
zone is obtained with the
clock is hardware dependent, and the time may be updated continuously or
in ``ticks.'' If
.Fa tp
-or
+is NULL
+and
.Fa tzp
-is NULL, the associated time
-information will not be returned or set.
+is non-NULL,
+.Fn gettimeofday
+will populate the timezone struct in
+.Fa tzp .
+If
+.Fa tp
+is non-NULL and
+.Fa tzp
+is NULL, then only the timeval struct in
+.Fa tp
+is populated. If both
+.Fa tp
+and
+.Fa tzp
+are NULL, nothing is returned.
.Pp
The structures pointed to by
.Fa tp
as:
.Pp
.Bd -literal
+
struct timeval {
time_t tv_sec; /* seconds since Jan. 1, 1970 */
suseconds_t tv_usec; /* and microseconds */
int tz_minuteswest; /* of Greenwich */
int tz_dsttime; /* type of dst correction to apply */
};
+
.Ed
.Pp
The
.Pp
Only the super-user may set the time of day or time zone.
If the system securelevel is greater than 1 (see
-.Xr init 8 ),
+.Xr launchd 8 ),
the time may only be advanced.
This limitation is imposed to prevent a malicious super-user
from setting arbitrary time stamps on files.