time
time_t time ( time_t * timer ); | time.h |
cplusplus.com |
Get current time.
Get the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock.
Parameters.
Return Value.
Elapsed time in seconds, as described.
Portability.
Defined in ANSI-C.
Example.
/* time example */
#include <stdio.h>
#include <time.h>
main ()
{
time_t seconds;
seconds = time (NULL);
printf ("%ld hours since January 1, 1970", seconds/3600);
return 0;
}
Output:
266344 hours since January 1, 1970
See also.
asctime,
gmtime,
localtime