aboutsummaryrefslogtreecommitdiff
path: root/source/time.h
diff options
context:
space:
mode:
authorEmil Williams2026-02-05 09:29:51 +0000
committerEmil Williams2026-02-05 09:29:51 +0000
commit45570024a49b80359d848329f2c363d5bf9af44a (patch)
tree31243e117a965569ecbc745eba88b25536b7fc99 /source/time.h
parenta5209153cf8df1cd58c2f70f9eabb0bf5dd071f8 (diff)
downloadEUROPAXI-45570024a49b80359d848329f2c363d5bf9af44a.tar.xz
EUROPAXI-45570024a49b80359d848329f2c363d5bf9af44a.tar.zst
assets & core8e8m
Diffstat (limited to 'source/time.h')
-rw-r--r--source/time.h14
1 files changed, 14 insertions, 0 deletions
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 <time.h>
+#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_ */