Gets or sets the system date and time.
#include <sys/time.h>
int gettimeofday( struct timeval *tvp, struct timezone *tzp ); int _gettimeofday32( struct _timeval32 *tvp ); int _gettimeofday64( struct _timeval64 *tvp ); int settimeofday( struct timeval *tvp, struct timezone *tzp // ignored ); int _settimeofday32( const struct _timeval32 *tvp ); int _settimeofday64( const struct _timeval64 *tvp );
tvp
tzp
timezone
structure.struct timeval { long32 tv_sec; /* seconds */ long32 tv_usec; /* and microseconds */ }; struct _timeval32{ long32 tv_sec; /* seconds */ long32 tv_usec; /* and microseconds */ }; struct _timeval64 { long64 tv_sec; /* seconds */ long32 tv_usec; /* and microseconds */ }; struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */ };
gettimeofday
obtains the current time, expressed as seconds and microseconds since the Epoch (January 1, 1970), and stores it in the structure
pointed to by tvp
. The parameter tzp
points to a struct timezone
which receives the number of minutes west of GMT and a flag determining if Day Saving Time is in effect. tzp
is ignored if NULL.
_gettimeofday32
uses the struct _timeval32
version of the structure, and _gettimeofday64
uses the struct _timeval64
version of the stucture. Neither of these calls returns timezone information.
settimeofday
set the system clock to seconds since the Epoch (microseconds are ignored). The tzp
value must be NULL.
_settimeofday32
uses the struct _timeval32
version of the structure, and _settimeofday64
uses the struct _timeval64
version of the stucture. Neither of these calls returns timezone information.
If the macro _USE_32BIT_TIMEVAL
is defined, gettimeofday
will actually call _gettimeofday32
, and settimeofday
will actually call _settimeofday32
. In both cases the tzp
parameter will be ignored.
If the macro _USE_64BIT_TIMEVAL
is defined, gettimeofday
will actually call _gettimeofday64
, and settimeofday
will actually call _settimeofday64
. In both cases the tzp
parameter will be ignored.
If neither macro is defined the original calls are made.
EFAULT
tvp
is an invalid pointer.
ENODEV
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 4.0 | intime/rt/include/sys/time.h | sys/time.h | clib.lib |
INtime 6.0 (32- and 64-bit versions) | intime/rt/include/sys/time.h | sys/time.h | clib.lib |