From 528e8c0002cf71b6f00602022dacd4996a213522 Mon Sep 17 00:00:00 2001 From: Martin Ling Date: Fri, 24 Jan 2020 04:55:32 +0000 Subject: [PATCH] windows: Fix warnings for conversions in time_as_timeval(). Building with MSVC gave: warning C4244: '=': conversion from 'LONGLONG' to 'long', possible loss of data when assigning the results of these calculation to the long fields of struct timeval. The result should be OK, but put an explicit cast in to make the change clear and suppress the warning. --- timing.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/timing.c b/timing.c index 8817e48..3a5f5c7 100644 --- a/timing.c +++ b/timing.c @@ -89,9 +89,9 @@ SP_PRIV void time_as_timeval(const struct time *time, struct timeval *tv) #ifdef _WIN32 LARGE_INTEGER frequency; QueryPerformanceFrequency(&frequency); - tv->tv_sec = time->ticks / frequency.QuadPart; - tv->tv_usec = (time->ticks % frequency.QuadPart) / - (frequency.QuadPart / 1000000); + tv->tv_sec = (long) (time->ticks / frequency.QuadPart); + tv->tv_usec = (long) ((time->ticks % frequency.QuadPart) / + (frequency.QuadPart / 1000000)); #else *tv = time->tv; #endif