diff options
| author | Emil Williams | 2026-02-05 09:29:51 +0000 |
|---|---|---|
| committer | Emil Williams | 2026-02-05 09:29:51 +0000 |
| commit | 45570024a49b80359d848329f2c363d5bf9af44a (patch) | |
| tree | 31243e117a965569ecbc745eba88b25536b7fc99 /source/time.h | |
| parent | a5209153cf8df1cd58c2f70f9eabb0bf5dd071f8 (diff) | |
| download | EUROPAXI-45570024a49b80359d848329f2c363d5bf9af44a.tar.xz EUROPAXI-45570024a49b80359d848329f2c363d5bf9af44a.tar.zst | |
assets & core8e8m
Diffstat (limited to 'source/time.h')
| -rw-r--r-- | source/time.h | 14 |
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_ */ |
