Purpose

This function returns the number of seconds since January 1, 1970.

Header File

time.h

Prototype

time_t time (time_t * Value);

Argument

*Value
(output) The number of seconds since January 1, 1970.

Return Value

The number of seconds since January 1, 1970.

Example

#include <stdio.h>
#include <time.h>

int main () {
  time_t Now;
  Now = time (NULL);
  printf ("The current time, in seconds since January 1, 1970, is %i.\n", 
          Now);
  Now = time (&Now);
  printf ("The current time, in seconds since January 1, 1970, is %i.\n", 
          Now);
  time (&Now);
  printf ("The current time, in seconds since January 1, 1970, is %i.\n", 
          Now);
  return 0;
}

Output

The current time, in seconds since January 1, 1970, is 1194673903.
The current time, in seconds since January 1, 1970, is 1194673903.
The current time, in seconds since January 1, 1970, is 1194673903.

Valid HTML 4.01 Transitional

Valid CSS

Site Icon Copyright © 1999-, jhyoung, revised 00/00/0