_USE_32BIT_TIME_T equivalent for gcc

In Visual Studio, I can force the use of 32-bit time_t by declaring _USE_32BIT_TIME_T, is there a similar equivalent for gcc? or is it always 32 bits or always 64 bits?

+4
source share
1 answer

The time_t type is not defined by gcc, but rather by the system library. On Linux, this is glibc, and it defines time_t in the time.h header:

 typedef __time_t time_t; 

which in turn is defined in bits/types.h :

 __STD_TYPE __TIME_T_TYPE __time_t; 

( __STD_TYPE definition is not interesting)

__TIME_T_TYPE defined in bits/typesizes.h :

 #define __TIME_T_TYPE __SLONGWORD_TYPE 

which in turn is defined in bits/types.h :

 #define __SLONGWORD_TYPE long int 

which is 32 bits on a 32-bit system, 64 bits on a 64-bit system. All these definitions are unconditional, therefore the equivalent of no _USE_32BIT_TIME_T on glibc.

+7
source

Source: https://habr.com/ru/post/1306839/


All Articles