time.h 912 B

1234567891011121314151617181920212223242526272829303132
  1. /** @file time.h
  2. * @brief Public interface for time service functions.
  3. */
  4. #ifndef _faux_time_h
  5. #define _faux_time_h
  6. #include <sys/time.h>
  7. #include <time.h>
  8. #include <stdint.h>
  9. #include <faux/faux.h>
  10. C_DECL_BEGIN
  11. // Operations for struct timespec
  12. int faux_timespec_cmp(const struct timespec *val1, const struct timespec *val2);
  13. bool_t faux_timespec_diff(struct timespec *res,
  14. const struct timespec *val1, const struct timespec *val2);
  15. bool_t faux_timespec_sum(struct timespec *res,
  16. const struct timespec *val1, const struct timespec *val2);
  17. bool_t faux_timespec_now(struct timespec *now);
  18. bool_t faux_timespec_now_monotonic(struct timespec *now);
  19. bool_t faux_timespec_before_now(const struct timespec *ts);
  20. // Convertions of struct timespec
  21. uint64_t faux_timespec_to_nsec(const struct timespec *ts);
  22. void faux_nsec_to_timespec(struct timespec *ts, uint64_t nsec);
  23. C_DECL_END
  24. #endif /* _faux_time_h */