gettimeofday(2) DG/UX 5.4R3.00 gettimeofday(2)
NAME
gettimeofday - get date and time
SYNOPSIS
#include <sys/time.h>
int gettimeofday (timevalue, timezone)
struct timeval * timevalue;
struct timezone * timezone;
where:
timevalue Address of a structure that will be set to the current
time.
timezone 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 timevalue and timezone.
If timezone 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 (tzminuteswest), and a value (tzdsttime) that indicates
the type of daylight savings time that applies locally during the
appropriate part of the year. The daylight savings time correction
flag (tzdsttime) further indicates the type of daylight savings time
correction to apply. The accepted values are:
DSTNONE DST does not apply.
DSTUSA USA DST correction.
DSTAUST Australian DST correction.
DSTWET Western European DST correction.
DSTMET Middle European DST correction.
DSTEET Eastern European DST correction.
The current local time may be computed using the current time zone by
the following calculation:
localusec = timevalue->tvusec;
localsec = timevalue->tvsec - timezone->tzminuteswest * 60
+ (isdst(timevalue,timezone) ? 60 * 60 : 0);
where isdst(tv,tz) is some function that returns TRUE if daylight
savings time is currently in effect.
Implementation Note
The DG/UX implementation of gettimeofday(2) is based on the BSD
implementation rather than the System V implementation. The System V
Licensed material--property of copyright holder(s) 1
gettimeofday(2) DG/UX 5.4R3.00 gettimeofday(2)
version has only one parameter, the time value. To achieve the System
V implementation in DG/UX, add the following lines to a source module
after including sys/time.h:
#undef gettimeofday
#define gettimeofday(tp) gettimeofday((tp), 0)
ACCESS CONTROL
None.
RETURN VALUE
0 Completed successfully.
-1 An error occurred. errno is set to indicate the error.
DIAGNOSTICS
Errno may be set to one of the following error codes:
EFAULT An argument address referenced invalid memory.
SEE ALSO
date(1), settimeofday(2), ctime(3C).
Licensed material--property of copyright holder(s) 2