X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..3e170ce000f1506b7b5d2c5c7faec85ceabb573d:/bsd/man/man2/gettimeofday.2 diff --git a/bsd/man/man2/gettimeofday.2 b/bsd/man/man2/gettimeofday.2 index febc61dcd..179e9bc0c 100644 --- a/bsd/man/man2/gettimeofday.2 +++ b/bsd/man/man2/gettimeofday.2 @@ -33,7 +33,7 @@ .\" .\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95 .\" -.Dd May 26, 1995 +.Dd August 5, 2008 .Dt GETTIMEOFDAY 2 .Os BSD 4 .Sh NAME @@ -43,14 +43,16 @@ .Sh SYNOPSIS .Fd #include .Ft int -.Fn gettimeofday "struct timeval *tp" "struct timezone *tzp" +.Fo gettimeofday +.Fa "struct timeval *restrict tp" +.Fa "void *restrict tzp" +.Fc .Ft int -.Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp" +.Fo settimeofday +.Fa "const struct timeval *tp" +.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 @@ -62,10 +64,24 @@ since midnight (0 hour), January 1, 1970. The resolution of the system clock is hardware dependent, and the time may be updated continuously or in ``ticks.'' If .Fa tp -or +is NULL +and +.Fa tzp +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 -is NULL, the associated time -information will not be returned or set. +are NULL, nothing is returned. .Pp The structures pointed to by .Fa tp @@ -76,18 +92,28 @@ are defined in as: .Pp .Bd -literal + struct timeval { - long tv_sec; /* seconds since Jan. 1, 1970 */ - long tv_usec; /* and microseconds */ + time_t tv_sec; /* seconds since Jan. 1, 1970 */ + suseconds_t tv_usec; /* and microseconds */ }; struct timezone { int tz_minuteswest; /* of Greenwich */ int tz_dsttime; /* type of dst correction to apply */ }; + .Ed .Pp The +.Fa timeval +structure specifies a time value in seconds and microseconds. +The values in +.Fa timeval +are opaque types whose length may vary on different machines; +depending on them to have any given length may lead to errors. +.Pp +The .Fa timezone structure indicates the local time zone (measured in minutes of time westward from Greenwich), @@ -97,7 +123,7 @@ the appropriate part of the year. .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. @@ -118,10 +144,24 @@ An argument address referenced invalid memory. .It Bq Er EPERM A user other than the super-user attempted to set the time. .El +.Sh LEGACY SYNOPSIS +.Fd #include +.Pp +.Ft int +.br +.Fo gettimeofday +.Fa "struct timeval *tp" +.Fa "struct timezone *tzp" +.Fc ; +.Pp +The type of +.Fa tzp +has changed. .Sh SEE ALSO .Xr date 1 , .Xr adjtime 2 , .Xr ctime 3 , +.Xr compat 5 , .Xr timed 8 .Sh HISTORY The