time.h
Standard C library with time and date related functions
Functions:
asctime Convert tm structure to string
clock Return number of clock ticks since process start
ctime Convert time_t value to string
difftime Return difference between two times
gmtime Convert time_t value to tm structure as UTC time
localtime Convert time_t value to tm structure as local time
mktime Convert tm structure to time_t value
time Get current time
time_t time ( time_t * timer );
Get current time.
Get the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock.
Parameters.
timer
Location where to store the retrieved value. If this is NULL the value is not stored. But it is still returned by the function.
time_t is generally defined by default to long.
Return Value.
Elapsed time in seconds, as described.
Portability.
Defined in ANSI-C.
Example.
/* time example */
#include <stdio.h>
#include <time.h>
int 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