From 50257aaab2fe845e515058fb42e1aaa7f2e6fae8 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Wed, 6 Sep 2023 03:31:15 +0200 Subject: test --- source/kit_test/shared.inl.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'source/kit_test') diff --git a/source/kit_test/shared.inl.h b/source/kit_test/shared.inl.h index 34ccb07..b96897c 100644 --- a/source/kit_test/shared.inl.h +++ b/source/kit_test/shared.inl.h @@ -22,7 +22,22 @@ # endif # include -static int timespec_get(struct timespec *ts, int base) { } +static int timespec_get(struct timespec *ts, int base) { + if (ts == NULL || base != TIME_UTC) + return 0; + FILETIME ft; + ULARGE_INTEGER date; + LONGLONG ticks; + + GetSystemTimeAsFileTime(&ft); + 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; + return base; +} # endif #endif // kit/time.h -- cgit v1.2.3