From 9eaa07a4b141bc80a46cb7ab2dc94048f126fa8c Mon Sep 17 00:00:00 2001 From: William McKinnon Date: Tue, 11 Jul 2023 00:44:26 -0400 Subject: added more scene dependencies, added tinywl --- include/util/time.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 include/util/time.h (limited to 'include/util/time.h') diff --git a/include/util/time.h b/include/util/time.h new file mode 100644 index 0000000..287698d --- /dev/null +++ b/include/util/time.h @@ -0,0 +1,27 @@ +#ifndef UTIL_TIME_H +#define UTIL_TIME_H + +#include + +/** + * Get the current time, in milliseconds. + */ +uint32_t get_current_time_msec(void); + +/** + * Convert a timespec to milliseconds. + */ +int64_t timespec_to_msec(const struct timespec *a); + +/** + * Convert nanoseconds to a timespec. + */ +void timespec_from_nsec(struct timespec *r, int64_t nsec); + +/** + * Subtracts timespec `b` from timespec `a`, and stores the difference in `r`. + */ +void timespec_sub(struct timespec *r, const struct timespec *a, + const struct timespec *b); + +#endif -- cgit v1.2.3