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.
This commit is contained in:
Martin Ling 2020-01-24 04:55:32 +00:00 committed by Uwe Hermann
parent 988ace6c9f
commit 528e8c0002
1 changed files with 3 additions and 3 deletions

View File

@ -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