1 #ifndef _TIME64_HELPERS_H 2 #define _TIME64_HELPERS_H 3 4 #include <linux/version.h> 5 #include <bits/types.h> 6 #include <time.h> 7 #include <stddef.h> 8 9 #if defined(__UCLIBC_USE_TIME64__) && __TARGET_ARCH_BITS__ == 32 && LINUX_VERSION_CODE < KERNEL_VERSION(5,1,0) 10 #error 64bit time on 32bit targets is not supported on Linux < 5.1.0 11 #endif 12 13 struct __ts64_struct { 14 __S64_TYPE tv_sec; 15 __S64_TYPE tv_nsec; 16 }; 17 18 #define TO_TS64_P(__ts) (((struct timespec *)(__ts)) ? \ 19 (&(struct __ts64_struct) {.tv_sec = ((struct timespec *)(__ts))->tv_sec, \ 20 .tv_nsec = ((struct timespec *)(__ts))->tv_nsec}) : NULL) 21 22 struct __its64_struct { 23 __S64_TYPE interval_tv_sec; 24 __S64_TYPE interval_tv_nsec; 25 __S64_TYPE value_tv_sec; 26 __S64_TYPE value_tv_nsec; 27 }; 28 29 #define TO_ITS64_P(__its) (((struct itimerspec *)(__its)) ? \ 30 (&(struct __its64_struct) {.interval_tv_sec = ((struct itimerspec *)(__its))->it_interval.tv_sec, \ 31 .interval_tv_nsec = ((struct itimerspec *)(__its))->it_interval.tv_nsec, \ 32 .value_tv_sec = ((struct itimerspec *)(__its))->it_value.tv_sec, \ 33 .value_tv_nsec = ((struct itimerspec *)(__its))->it_value.tv_nsec}) : NULL) 34 35 36 #endif /* _TIME64_HELPERS_H */ 37