time64_helpers.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 __ts32_struct {
  7. __S32_TYPE tv_sec;
  8. __S32_TYPE tv_nsec;
  9. };
  10. struct __ts64_struct {
  11. __S64_TYPE tv_sec;
  12. __S64_TYPE tv_nsec;
  13. };
  14. #define TO_TS64_P(__ts) (((struct timespec *)(__ts)) ? \
  15. (&(struct __ts64_struct) {.tv_sec = ((struct timespec *)(__ts))->tv_sec, \
  16. .tv_nsec = ((struct timespec *)(__ts))->tv_nsec}) : NULL)
  17. struct __its64_struct {
  18. __S64_TYPE interval_tv_sec;
  19. __S64_TYPE interval_tv_nsec;
  20. __S64_TYPE value_tv_sec;
  21. __S64_TYPE value_tv_nsec;
  22. };
  23. #define TO_ITS64_P(__its) (((struct itimerspec *)(__its)) ? \
  24. (&(struct __its64_struct) {.interval_tv_sec = ((struct itimerspec *)(__its))->it_interval.tv_sec, \
  25. .interval_tv_nsec = ((struct itimerspec *)(__its))->it_interval.tv_nsec, \
  26. .value_tv_sec = ((struct itimerspec *)(__its))->it_value.tv_sec, \
  27. .value_tv_nsec = ((struct itimerspec *)(__its))->it_value.tv_nsec}) : NULL)
  28. #endif /* _TIME64_HELPERS_H */