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.

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>

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


© The C++ Resources Network, 2000