![]() |
![]() |
![]() |
Get the current time
#include <sys/time.h> int gettimeofday( struct timeval * when, void * not_used );
libc
The gettimeofday() function returns the current time in when in seconds and microseconds, since the Unix Epoch, 00:00:00 January 1, 1970 Coordinated Universal Time (UTC) (formerly known as Greenwich Mean Time (GMT)). The struct timeval contains the following members:
The not_used pointer must be NULL or the behavior of gettimeofday() is unspecified. It's provided only for backwards compatibility.
0 for success, or -1 if an error occurs (errno is set).
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
The gettimeofday() function is provided for porting existing code; it shouldn't be used in new code. Use clock_gettime() instead.
asctime(), asctime_r(), clock_gettime(), clock_settime(), ctime(), ctime_r(), difftime(), gmtime(), gmtime_r(), localtime(), localtime_r(), time()
![]() |
![]() |
![]() |