gettimeofday(3C-ucb) (BSD Compatibility Package) gettimeofday(3C-ucb)
NAME
gettimeofday, settimeofday - get or set the date and time
SYNOPSIS
/usr/ucb/cc [flag ...] file ... -lucb
#include <sys/time.h>
int gettimeofday(tp, tzp)
struct timeval *tp;
struct timezone *tzp; /* obsolete */
int settimeofday(tp, tzp)
struct timeval *tp;
struct timezone *tzp; /* obsolete */
DESCRIPTION
The system's notion of the current Greenwich time is obtained with the
gettimeofday call, and set with the settimeofday call. The current
time is expressed in elapsed seconds and microseconds since 00:00 GMT,
January 1, 1970 (zero hour). The resolution of the system clock is
hardware dependent; the time may be updated continuously, or in ticks.
tp points to a timeval structure, which includes the following
members:
long tvsec; /* seconds since Jan. 1, 1970 */
long tvusec; /* and microseconds */
If tp is a NULL pointer, the current time information is not returned
or set.
tzp is an obsolete pointer formerly used to get and set timezone
information. tzp is now ignored. Timezone information is now handled
using the TZ environment variable [see timezone(4)].
Only the privileged user may set the time of day.
RETURN VALUE
A -1 return value indicates an error occurred; in this case an error
code is stored in the global variable errno.
DIAGNOSTICS
The following error codes may be set in errno:
EINVAL tp specifies an invalid time.
EPERM A user other than the privileged user attempted to set the
time.
Page 1 Reliant UNIX 5.44 Printed 11/98
gettimeofday(3C-ucb) (BSD Compatibility Package) gettimeofday(3C-ucb)
NOTES
Time is never correct enough to believe the microsecond values.
tzp is ignored.
SEE ALSO
date(1), adjtime(2), ctime(3C), gettimeofday(3C), timezone(4).
Page 2 Reliant UNIX 5.44 Printed 11/98