GETTIMEOFDAY(3) Library Functions Manual GETTIMEOFDAY(3)

gettimeofdayget the date and time


#include <sys/time.h>

int gettimeofday(struct timeval *restrict tp, void *restrict tzp);

The gettimeofday () function shall obtain the current time, expressed as seconds and microseconds since the Epoch, and store it in the structure pointed to by . The resolution of the system clock is unspecified.

If is not a null pointer, the behavior is unspecified.

The gettimeofday () function shall return 0 and no value shall be reserved to indicate an error.

No errors are defined.

None.

Applications should use the clock_gettime(3) function instead of the obsolescent gettimeofday () function.

None.

The gettimeofday () function may be removed in a future version.

clock_getres(3) , ctime(3)

XBD <sys/time.h>

First released in Issue 4, Version 2.

Moved from X/OPEN UNIX extension to BASE.

The DESCRIPTION is updated to refer to "seconds since the Epoch" rather than "seconds since 00:00:00 UTC (Coordinated Universal Time), January 1 1970" for consistency with other functions.

The keyword is added to the gettimeofday () prototype for alignment with the ISO/IEC 9899:1999 (“ISO C99”) standard.

The gettimeofday () function is marked obsolescent.

January 1, 2008 posix.fail