I searched in linux box and saw it being typedef to
typedef __time_t time_t;
But could not find the __time_t definition.
I searched in linux box and saw it being typedef to
typedef __time_t time_t;
But could not find the __time_t definition.
It's a 32-bit signed integer type on most legacy platforms. However, that causes your code to suffer from the year 2038 bug. So modern C libraries should be defining it to be a signed 64-bit int instead, which is safe for a few billion years.
[root]# cat time.c
[root]# gcc -E time.c | grep __time_t
typedef long int __time_t;
It's defined in
$INCDIR/bits/types.h
through:The time_t Wikipedia article article sheds some light on this. The bottom line is that the type of
time_t
is not guaranteed in the C specification.Under Visual Studio 2008, it defaults to an
__int64
unless you define_USE_32BIT_TIME_T
. You're better off just pretending that you don't know what it's defined as, since it can (and will) change from platform to platform.