gettimeofday(2) DG/UX 4.30 gettimeofday(2)
NAME
gettimeofday - Get date and time.
SYNOPSIS
#include <sys/time.h>
int gettimeofday (time_value, time_zone)
struct timeval * time_value;
struct timezone * time_zone;
PARAMETERS
time_value Address of a structure that will be set to
the current time.
time_zone NULL or address of a structure that will be
set to the current time zone.
DESCRIPTION
Gettimeofday returns the system's notion of the current
Greenwich time and the current time zone to the structures
at the locations specified by <time_value> and <time_zone>.
If <time_zone> is NULL, the current time zone is not
returned.
The time value returned is Greenwich time expressed in
seconds and microseconds since midnight January 1, 1970.
The local time zone is expressed in minutes of time westward
from Greenwich (tz_minuteswest), and a value (tz_dsttime)
that indicates the type of daylight savings time that
applies locally during the appropriate part of the year.
The daylight savings time correction flag (tz_dsttime)
further indicates the type of daylight savings time
correction to apply. The accepted values are:
DST_NONE DST does not apply.
DST_USA USA DST correction.
DST_AUST Australian DST correction.
DST_WET Western European DST correction.
DST_MET Middle European DST correction.
DST_EET Eastern European DST correction.
The current local time may be computed using the current
time zone by the following calculation:
Licensed material--property of copyright holder(s) Page 1
gettimeofday(2) DG/UX 4.30 gettimeofday(2)
local_usec = time_value->tv_usec;
local_sec = time_value->tv_sec - time_zone->tz_minuteswest * 60 +
(is_dst(time_value,time_zone) ? 60 * 60 : 0);
where is_dst(tv,tz) is some function that returns TRUE if
daylight savings time is currently in effect.
ACCESS CONTROL
None.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EFAULT An argument address referenced invalid
memory.
SEE ALSO
The related manual sections: date(1),
settimeofday(2),
ctime(3).
Licensed material--property of copyright holder(s) Page 2