summaryrefslogtreecommitdiffstats
path: root/ext/lsm1/lsm-test/lsmtest_win32.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 17:28:19 +0000
commit18657a960e125336f704ea058e25c27bd3900dcb (patch)
tree17b438b680ed45a996d7b59951e6aa34023783f2 /ext/lsm1/lsm-test/lsmtest_win32.c
parentInitial commit. (diff)
downloadsqlite3-upstream.tar.xz
sqlite3-upstream.zip
Adding upstream version 3.40.1.upstream/3.40.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ext/lsm1/lsm-test/lsmtest_win32.c')
-rw-r--r--ext/lsm1/lsm-test/lsmtest_win32.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/lsm1/lsm-test/lsmtest_win32.c b/ext/lsm1/lsm-test/lsmtest_win32.c
new file mode 100644
index 0000000..9472723
--- /dev/null
+++ b/ext/lsm1/lsm-test/lsmtest_win32.c
@@ -0,0 +1,30 @@
+
+#include "lsmtest.h"
+
+#ifdef _WIN32
+
+#define TICKS_PER_SECOND (10000000)
+#define TICKS_PER_MICROSECOND (10)
+#define TICKS_UNIX_EPOCH (116444736000000000LL)
+
+int win32GetTimeOfDay(
+ struct timeval *tp,
+ void *tzp
+){
+ FILETIME fileTime;
+ ULONGLONG ticks;
+ ULONGLONG unixTicks;
+
+ unused_parameter(tzp);
+ memset(&fileTime, 0, sizeof(FILETIME));
+ GetSystemTimeAsFileTime(&fileTime);
+ ticks = (ULONGLONG)fileTime.dwHighDateTime << 32;
+ ticks |= (ULONGLONG)fileTime.dwLowDateTime;
+ unixTicks = ticks - TICKS_UNIX_EPOCH;
+ tp->tv_sec = (long)(unixTicks / TICKS_PER_SECOND);
+ unixTicks -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
+ tp->tv_usec = (long)(unixTicks / TICKS_PER_MICROSECOND);
+
+ return 0;
+}
+#endif