##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# time_t

From cppreference.com
< c‎ | chrono

Defined in header `<time.h>` |  |
typedef /* unspecified */ time_t; |  |

Arithmetic type capable of representing times.

Although not defined, this is almost always an integral value holding the number of seconds (not counting leap seconds) since 00:00, Jan 1 1970 UTC, corresponding to POSIX time.

### [edit] Example

Show the start of the epoch.

Run this code

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

    int main(void)
    {
        time_t epoch = 0;
        printf("%d seconds since the epoch began\n", (int)epoch);
        printf("%s\n", asctime(localtime(&epoch)));

        return 0;
    }

Possible output:

    0 seconds since the epoch began
    Thu Jan  1 00:00:00 1970

### [edit] See also

time | returns the current calendar time of the system as time since epoch (function) [edit]
localtime | converts time since epoch to calendar time expressed as local time (function) [edit]
gmtime | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) [edit]
C++ documentation for time_t

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/chrono/time_t&oldid=71468"