time.h 742 B

1234567891011121314151617181920212223242526272829
  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. int faux_timespec_diff(struct timespec *res,
  14. const struct timespec *val1, const struct timespec *val2);
  15. int faux_timespec_sum(struct timespec *res,
  16. const struct timespec *val1, const struct timespec *val2);
  17. // Conversations of struct timespec
  18. uint64_t faux_timespec_to_nsec(const struct timespec *ts);
  19. void faux_nsec_to_timespec(struct timespec *ts, uint64_t nsec);
  20. C_DECL_END
  21. #endif /* _faux_time_h */