summaryrefslogtreecommitdiff
path: root/source/kit_test
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-06 03:35:24 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-06 03:35:24 +0200
commit1aed4ad849e89f00281afb6654367994f99b6110 (patch)
tree3aa28cee5382e4a76422b8c743c0369ef638995f /source/kit_test
parentec667855740993a1c63eb2d2c64b4fc29d95a003 (diff)
downloadkit-1aed4ad849e89f00281afb6654367994f99b6110.zip
Fix timespec_get impl
Diffstat (limited to 'source/kit_test')
-rw-r--r--source/kit_test/shared.inl.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/kit_test/shared.inl.h b/source/kit_test/shared.inl.h
index f000786..11b42bb 100644
--- a/source/kit_test/shared.inl.h
+++ b/source/kit_test/shared.inl.h
@@ -22,6 +22,10 @@
# endif
# include <Windows.h>
+# define KIT_TIMESPEC_IMPL_UNIX_EPOCH_IN_TICKS \
+ 116444736000000000ull
+# define KIT_TIMESPEC_IMPL_TICKS_PER_SECONDS 10000000ull
+
static int timespec_get(struct timespec *ts, int base) {
if (ts == NULL || base != TIME_UTC)
return 0;
@@ -34,9 +38,9 @@ static int timespec_get(struct timespec *ts, int base) {
date.HighPart = ft.dwHighDateTime;
date.LowPart = ft.dwLowDateTime;
ticks = (LONGLONG) (date.QuadPart -
- _TIMESPEC_IMPL_UNIX_EPOCH_IN_TICKS);
- ts->tv_sec = ticks / _TIMESPEC_IMPL_TICKS_PER_SECONDS;
- ts->tv_nsec = (ticks % _TIMESPEC_IMPL_TICKS_PER_SECONDS) * 100;
+ KIT_TIMESPEC_IMPL_UNIX_EPOCH_IN_TICKS);
+ ts->tv_sec = ticks / KIT_TIMESPEC_IMPL_TICKS_PER_SECONDS;
+ ts->tv_nsec = (ticks % KIT_TIMESPEC_IMPL_TICKS_PER_SECONDS) * 100;
return base;
}