OpenBSD manual page server

Manual Page Search Parameters

TIME(3) Library Functions Manual TIME(3)

timeget time of day

#include <time.h>

time_t
time(time_t *now);

The () function returns the number of seconds elapsed since Jan 1 1970 00:00:00 UTC. This value is also written to now unless now is NULL.

The time() function is always successful, and no return value is reserved to indicate an error.

clock_gettime(2), gettimeofday(2), ctime(3)

The time() function conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

A time() system call first appeared in Version 1 AT&T UNIX. That version counted time in sixtieths of a second with a 32-bit return value, ensuring an integer overflow crisis every 2.26 years. In Version 6 AT&T UNIX the granularity of the return value was reduced to whole seconds, delaying the aforementioned crisis until 2038. In 4.1cBSD the function was moved out of the kernel into the C standard library and reimplemented with gettimeofday(2).

December 11, 2021 OpenBSD-current