Home Segments Index Top Previous Next

583: Mainline

The time function has a pointer parameter of type time_t, where time_t in many implementations is defined via a typedef statement in the time library to be a synonym for long. The purpose of the time function is to set a time_t-type variable, one declared by you, to the number of elapsed seconds since the beginning of 1970.

/* Declare variable to hold clock ticks since 1970 */ 
time_t elapsed_seconds; 
...
/* Fetch elapsed seconds from operating system */ 
time(&elapsed_seconds);