The time_t function returns the time since 00:00:00 UTC, January 1, 1970 (Unix timestamp) in seconds. The time.h header file needs to be included to use this function, as shown below:
#include <time.h>
time_t time( time_t *second )
If the variable second is not a NULL pointer, the return value of this function is also stored in the second variable.
The time_t function takes a single argument. This is a pointer to an object of type time_t. The value of seconds is stored in this object.
The return value for this function is the current calendar time as an object time_t type.
The following code shows the use of the time_t function:
#include <stdio.h>#include <time.h>int main () {time_t second;second = time(NULL);printf("Seconds passed since January 1, 1970 = %ld\n", second);return(0);}
Free Resources