Facebook Page Twitter Page LinkedIn Page
× C Standard Library

The C <time.h> time_t type is an alias of a fundamental arithmetic type capable of representing times, as returned by time() function.

It is generally implemented as an integral value representing the number of seconds holding the number of seconds elapsed since 00:00, Jan 1 1970 UTC (i.e., a unix timestamp). Although libraries may use a different representation of time.

In the <time.h> header file, it is defined as follows:

typedef /* unspecified */ time_t;              


The below example shows the usage of time_t type.

#include <stdio.h>
#include <time.h>
int main (){
  time_t t = 3600;
  printf("Time elapsed since the epoch began: %d seconds\n",

  //displaying the time
  printf("%s", asctime(gmtime(&t)));

  return 0;

The output of the above code will be:

Time elapsed since the epoch began: 3600 seconds
Thu Jan  1 01:00:00 1970

❮ C <time.h> Library