test: fixup for Windows.

Change-Id: I13468caf53988d9599235d1423603146abf9eb46
This commit is contained in:
Leo Yuriev
2017-04-23 12:55:45 +03:00
parent c4846c8141
commit a0f1d61a4a
6 changed files with 25 additions and 9 deletions

View File

@@ -94,7 +94,8 @@ time now_motonic() {
if (reciprocal == 0) {
if (!QueryPerformanceFrequency(&Frequency))
failure_perror("QueryPerformanceFrequency()", GetLastError());
reciprocal = (UINT64_C(1) << 32) / Frequency.QuadPart;
reciprocal =
((UINT64_C(1) << 32) + Frequency.QuadPart / 2) / Frequency.QuadPart;
assert(reciprocal);
}
@@ -107,7 +108,6 @@ time now_motonic() {
uint64_t mod = Counter.QuadPart % Frequency.QuadPart;
assert(mod < UINT32_MAX);
result.fractional = UInt32x32To64((uint32_t)mod, reciprocal);
assert(result.fractional == (mod << 32) / Frequency.QuadPart);
return result;
#else
struct timespec ts;