time64_helpers.h 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #ifndef _TIME64_HELPERS_H
  2. #define _TIME64_HELPERS_H
  3. #include <bits/types.h>
  4. #include <time.h>
  5. #include <stddef.h>
  6. struct __ts64_struct {
  7. __S64_TYPE tv_sec;
  8. __S64_TYPE tv_nsec;
  9. };
  10. #define TO_TS64_P(__ts) (((struct timespec *)(__ts)) ? \
  11. (&(struct __ts64_struct) {.tv_sec = ((struct timespec *)(__ts))->tv_sec, \
  12. .tv_nsec = ((struct timespec *)(__ts))->tv_nsec}) : NULL)
  13. struct __its64_struct {
  14. __S64_TYPE interval_tv_sec;
  15. __S64_TYPE interval_tv_nsec;
  16. __S64_TYPE value_tv_sec;
  17. __S64_TYPE value_tv_nsec;
  18. };
  19. #define TO_ITS64_P(__its) (((struct itimerspec *)(__its)) ? \
  20. (&(struct __its64_struct) {.interval_tv_sec = ((struct itimerspec *)(__its))->it_interval.tv_sec, \
  21. .interval_tv_nsec = ((struct itimerspec *)(__its))->it_interval.tv_nsec, \
  22. .value_tv_sec = ((struct itimerspec *)(__its))->it_value.tv_sec, \
  23. .value_tv_nsec = ((struct itimerspec *)(__its))->it_value.tv_nsec}) : NULL)
  24. #endif /* _TIME64_HELPERS_H */