From 45570024a49b80359d848329f2c363d5bf9af44a Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Thu, 5 Feb 2026 09:29:51 +0000 Subject: assets & core --- source/time.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 source/time.h (limited to 'source/time.h') diff --git a/source/time.h b/source/time.h new file mode 100644 index 0000000..ca151f1 --- /dev/null +++ b/source/time.h @@ -0,0 +1,14 @@ +#ifndef TIME_H_ +#define TIME_H_ +#include +#define TIMESPEC_TO_DOUBLE(ts) ((double)(ts).tv_sec + ((double)(ts).tv_nsec / TIMESPEC_HZ)) +enum { TIMESPEC_HZ = 1000000000 }; + +const struct timespec one_second = {1, 0}, zero_seconds = {0, 0}; + +struct timespec timespec_add(struct timespec a, struct timespec b); +struct timespec timespec_sub(struct timespec a, struct timespec b); +int timespec_cmp(struct timespec a, struct timespec b); +struct timespec timespec_min(struct timespec a, struct timespec b); +struct timespec timespec_max(struct timespec a, struct timespec b); +#endif /* TIME_H_ */ -- cgit v1.2.3