From 61a8d97ad9eff8a5e8b0d05d3b421062cd5427de Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Mon, 10 Apr 2017 09:41:00 -0400 Subject: [PATCH] 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 --- src/win/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win/util.c b/src/win/util.c index 3c1d9bed..6b2bc2d7 100644 --- a/src/win/util.c +++ b/src/win/util.c @@ -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; }