win: return a floored double from uv_uptime()

This makes Windows consistent with other platforms.

Refs: https://github.com/libuv/libuv/issues/1295
Fixes: https://github.com/libuv/libuv/issues/1294
PR-URL: https://github.com/libuv/libuv/pull/1296
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Refael Ackermann 2017-04-10 09:41:00 -04:00 committed by cjihrig
parent 1d1287d764
commit 61a8d97ad9
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -587,8 +587,8 @@ int uv_uptime(double* uptime) {
BYTE* address = (BYTE*) object_type + object_type->DefinitionLength +
counter_definition->CounterOffset;
uint64_t value = *((uint64_t*) address);
*uptime = (double) (object_type->PerfTime.QuadPart - value) /
(double) object_type->PerfFreq.QuadPart;
*uptime = floor((double) (object_type->PerfTime.QuadPart - value) /
(double) object_type->PerfFreq.QuadPart);
uv__free(malloced_buffer);
return 0;
}