I searched my Linux box and saw this typedef:
typedef __time_t time_t;
But I could not find the __time_t
definition.
Standards
William Brendel quoted Wikipedia, but I prefer it from the horse's mouth.
C99 N1256 standard draft 7.23.1/3 "Components of time" says:
The types declared are size_t (described in 7.17) clock_t and time_t which are arithmetic types capable of representing times
and 6.2.5/18 "Types" says:
Integer and floating types are collectively called arithmetic types.
POSIX 7 sys_types.h says:
[CX] time_t shall be an integer type.
where [CX]
is defined as:
[CX] Extension to the ISO C standard.
It is an extension because it makes a stronger guarantee: floating points are out.
gcc one-liner
No need to create a file as mentioned by Quassnoi:
echo | gcc -E -xc -include 'time.h' - | grep time_t
On Ubuntu 15.10 GCC 5.2 the top two lines are:
typedef long int __time_t;
typedef __time_t time_t;
Command breakdown with some quotes from man gcc
:
-E
: "Stop after the preprocessing stage; do not run the compiler proper."-xc
: Specify C language, since input comes from stdin which has no file extension.-include file
: "Process file as if "#include "file"" appeared as the first line of the primary source file."-
: input from stdin