On Visual studio I can force use of 32-bit time_t
by declaring _USE_32BIT_TIME_T
. Is there a similar equivalent for gcc? or is it always 32-bit or is it always 64-bit?
The time_t
type is not defined by gcc but rather by system library. On Linux, this is glibc, and it defines time_t
in time.h
header:
typedef __time_t time_t;
which is in turn defined in bits/types.h
:
__STD_TYPE __TIME_T_TYPE __time_t;
(__STD_TYPE
definition is not interesting),
__TIME_T_TYPE
is defined in bits/typesizes.h
:
#define __TIME_T_TYPE __SLONGWORD_TYPE
which is in turn defined in bits/types.h
:
#define __SLONGWORD_TYPE long int
which is 32 bits on 32 bits system, 64 bits on 64 bits system. All these definitions are unconditional, so, no _USE_32BIT_TIME_T
equivalent on glibc.