Initial work on porting lsmtest to Win32.
[sqlite.git] / ext / lsm1 / lsm-test / lsmtest_win32.c
blob772c1706f06a309cc3d58accae634e2326973f06
2 #include "lsmtest.h"
4 #ifdef _WIN32
6 #define TICKS_PER_SECOND (10000000)
7 #define TICKS_PER_MICROSECOND (10)
8 #define TICKS_UNIX_EPOCH (116444736000000000LL)
10 int win32GetTimeOfDay(
11 struct timeval *tp,
12 void *tzp
14 FILETIME fileTime;
15 ULARGE_INTEGER largeInteger;
16 ULONGLONG temp;
18 unused_parameter(tzp);
19 memset(&fileTime, 0, sizeof(FILETIME));
20 GetSystemTimeAsFileTime(&fileTime);
21 memset(&largeInteger, 0, sizeof(ULARGE_INTEGER));
22 largeInteger.LowPart = fileTime.dwLowDateTime;
23 largeInteger.HighPart = fileTime.dwHighDateTime;
24 temp = largeInteger.QuadPart - TICKS_UNIX_EPOCH;
25 tp->tv_sec = (long)(temp / TICKS_PER_SECOND);
26 temp -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
27 tp->tv_usec = (long)(temp / TICKS_PER_MICROSECOND);
28 return 0;
30 #endif