mdbx-chk: avoid use GetTickCount64() for Windows 2000/XP.

Change-Id: Ibad5c5ec0590cd3776283237de2cb83126785726
This commit is contained in:
Leonid Yuriev 2020-10-08 01:27:41 +03:00
parent 9b64b95bbc
commit c139eacb2d

View File

@ -46,6 +46,14 @@ static BOOL WINAPI ConsoleBreakHandlerRoutine(DWORD dwCtrlType) {
return true;
}
static uint64_t GetMilliseconds(void) {
LARGE_INTEGER Counter, Frequency;
return (QueryPerformanceFrequency(&Frequency) &&
QueryPerformanceCounter(&Counter))
? Counter.QuadPart * 1000ul / Frequency.QuadPart
: 0;
}
#else /* WINDOWS */
static volatile sig_atomic_t user_break;
@ -1032,7 +1040,7 @@ int main(int argc, char *argv[]) {
double elapsed;
#if defined(_WIN32) || defined(_WIN64)
uint64_t timestamp_start, timestamp_finish;
timestamp_start = GetTickCount64();
timestamp_start = GetMilliseconds();
#else
struct timespec timestamp_start, timestamp_finish;
if (clock_gettime(CLOCK_MONOTONIC, &timestamp_start)) {
@ -1644,7 +1652,7 @@ bailout:
}
#if defined(_WIN32) || defined(_WIN64)
timestamp_finish = GetTickCount64();
timestamp_finish = GetMilliseconds();
elapsed = (timestamp_finish - timestamp_start) * 1e-3;
#else
if (clock_gettime(CLOCK_MONOTONIC, &timestamp_finish)) {