sqlite/ext/lsm1/lsm-test/lsmtest_win32.c
mistachkin ec99c0f632 Improve a local variable name.
FossilOrigin-Name: d0f6973d93c36451bf64f47de9a88abec613a624603033bf6717f5071139b6d2
2017-06-27 22:33:06 +00:00

31 lines
789 B
C

#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;
ULARGE_INTEGER largeInteger;
ULONGLONG ticks;
unused_parameter(tzp);
memset(&fileTime, 0, sizeof(FILETIME));
GetSystemTimeAsFileTime(&fileTime);
memset(&largeInteger, 0, sizeof(ULARGE_INTEGER));
largeInteger.LowPart = fileTime.dwLowDateTime;
largeInteger.HighPart = fileTime.dwHighDateTime;
ticks = largeInteger.QuadPart - TICKS_UNIX_EPOCH;
tp->tv_sec = (long)(ticks / TICKS_PER_SECOND);
ticks -= ((ULONGLONG)tp->tv_sec * TICKS_PER_SECOND);
tp->tv_usec = (long)(ticks / TICKS_PER_MICROSECOND);
return 0;
}
#endif