summaryrefslogtreecommitdiff
path: root/kit/time.h
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-11-17 05:24:04 +0100
committerMitya Selivanov <automainint@guattari.tech>2024-11-17 05:24:04 +0100
commitd5a727a062e4d727491f4e7f047269d60a93a8cf (patch)
tree565aec155ab056f1bef8ddc7dc78d52e65aa76b7 /kit/time.h
parent4ba961dcbf60f7c12f53f46baa261757e15d5931 (diff)
downloadsaw-d5a727a062e4d727491f4e7f047269d60a93a8cf.zip
Remove lots of dependencies
Diffstat (limited to 'kit/time.h')
-rw-r--r--kit/time.h54
1 files changed, 0 insertions, 54 deletions
diff --git a/kit/time.h b/kit/time.h
deleted file mode 100644
index c14f8ff..0000000
--- a/kit/time.h
+++ /dev/null
@@ -1,54 +0,0 @@
-#ifndef KIT_TIME_H
-#define KIT_TIME_H
-
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE
-#endif
-
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef TIME_UTC
-# define TIME_UTC 1
-#endif
-
-#ifdef KIT_REQUIRE_TIMESPEC_GET
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN 1
-# endif
-# ifndef NOMINMAX
-# define NOMINMAX 1
-# 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;
-
- FILETIME ft;
- ULARGE_INTEGER date;
- LONGLONG ticks;
-
- GetSystemTimeAsFileTime(&ft);
- date.HighPart = ft.dwHighDateTime;
- date.LowPart = ft.dwLowDateTime;
- ticks = (LONGLONG) (date.QuadPart -
- 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;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif