Defined in header <time.h> | ||
---|---|---|
typedef /* unspecified */ time_t; |
Arithmetic (until C11) Real (since C11) type capable of representing times.
Although not defined by the C standard, 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.
The standard uses the term calendar time when referring to a value of type time_t
.
Show the start of the epoch.
#include <stdio.h> #include <time.h> int main(void) { time_t epoch = 0; printf("%ld seconds since the epoch began\n", (long)epoch); printf("%s", asctime(gmtime(&epoch))); }
Possible output:
0 seconds since the epoch began Thu Jan 1 00:00:00 1970
returns the current calendar time of the system as time since epoch (function) |
|
(C11) | converts time since epoch to calendar time expressed as local time (function) |
(C11) | converts time since epoch to calendar time expressed as Coordinated Universal Time (UTC) (function) |
C++ documentation for time_t |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/c/chrono/time_t