Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (f - i) gettimeofday(2)
NAME
gettimeofday - Gets date and time
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossksrl
H-series OSS processes: /G/system/zdllnnn/zosskdll
SYNOPSIS
#include <sys/time.h>
int gettimeofday(
struct timeval *tp,
struct timezone *tzp);
PARAMETERS
tp Points to a timeval structure, dened in the sys/time.h le. The timeval struc-
ture contains the current time when the call is completed. If a null pointer is
specied, then the current time is not returned.
tzp Points to a timezone structure, dened in the sys/time.h le. The timezone
structure contains the current time zone when the call is completed. If a null
pointer is specied, then the current time zone is not returned.
DESCRIPTION
The gettimeofday() function gets the system values for the current time and time zone. The time
is expressed in seconds and microseconds since midnight (0 hour), January 1, 1970.
The timeval structure contains the following elds:
tv_sec The number of whole seconds of elapsed time.
tv_usec The number of additional microseconds of elapsed time.
The timezone structure contains the following elds:
tz_minuteswest
The local time zone, measured in minutes of time westward from Coordinated
Universal Time (Greenwich, England).
tz_dsttime A value that indicates which daylight-saving time correction applies locally dur-
ing the appropriate part of the year.
This value is always set to 0 (zero) upon successful completion, because the
information required to return an accurate nonzero value is not available.
Use From the Guardian Environment
This function cannot be used in the Guardian environment. When the gettimeofday() function is
called from the Guardian environment, the call fails and errno is set to [ENOTOSS].
NOTES
The gettimeofday() function is supported for compatibility with BSD programs. This function
provides a process-local time-zone parameter in addition to the systemwide time and date.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, the value -1 is returned
and errno is set to indicate the error.
527186-003 Hewlett-Packard Company 357