mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-14 23:08:00 +02:00
Add explicit time32 and time64 support
Handle the three potential system scenarios: - system time_t is time64 - system time_t is time32 and supports time64 - system time_t is time32 and does not support time64 Add the explicit time32 and time64 functions when necessary and map them accordingly for each of these cases.
This commit is contained in:
@@ -86,6 +86,10 @@
|
||||
#define _SYS_CDEFS_H
|
||||
#endif
|
||||
|
||||
/* Define the ABI for the current system. */
|
||||
//#define LIBBSD_SYS_TIME_BITS 0
|
||||
//#define LIBBSD_SYS_HAS_TIME64 0
|
||||
|
||||
#define LIBBSD_CONCAT(x, y) x ## y
|
||||
#define LIBBSD_STRING(x) #x
|
||||
|
||||
|
@@ -58,4 +58,17 @@ time_t _long_to_time(long tlong);
|
||||
int _time_to_int(time_t t);
|
||||
time_t _int_to_time(int tint);
|
||||
|
||||
#if LIBBSD_SYS_TIME_BITS == 32 && LIBBSD_SYS_HAS_TIME64
|
||||
#if defined _TIME_BITS && _TIME_BITS == 64
|
||||
time_t LIBBSD_REDIRECT(_time32_to_time, (int32_t t32), _time32_to_time_time64);
|
||||
int32_t LIBBSD_REDIRECT(_time_to_time32, (time_t t), _time_to_time32_time64);
|
||||
time_t LIBBSD_REDIRECT(_time64_to_time, (int64_t t64), _time64_to_time_time64);
|
||||
int64_t LIBBSD_REDIRECT(_time_to_time64, (time_t t), _time_to_time64_time64);
|
||||
long LIBBSD_REDIRECT(_time_to_long, (time_t t), _time_to_long_time64);
|
||||
time_t LIBBSD_REDIRECT(_long_to_time, (long tlong), _long_to_time_time64);
|
||||
int LIBBSD_REDIRECT(_time_to_int, (time_t t), _time_to_int_time64);
|
||||
time_t LIBBSD_REDIRECT(_int_to_time, (int tint), _int_to_time_time64);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* LIBBSD_TIMECONV_H */
|
||||
|
Reference in New Issue
Block a user