mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
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:
parent
988ace6c9f
commit
528e8c0002
6
timing.c
6
timing.c
@ -89,9 +89,9 @@ SP_PRIV void time_as_timeval(const struct time *time, struct timeval *tv)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LARGE_INTEGER frequency;
|
LARGE_INTEGER frequency;
|
||||||
QueryPerformanceFrequency(&frequency);
|
QueryPerformanceFrequency(&frequency);
|
||||||
tv->tv_sec = time->ticks / frequency.QuadPart;
|
tv->tv_sec = (long) (time->ticks / frequency.QuadPart);
|
||||||
tv->tv_usec = (time->ticks % frequency.QuadPart) /
|
tv->tv_usec = (long) ((time->ticks % frequency.QuadPart) /
|
||||||
(frequency.QuadPart / 1000000);
|
(frequency.QuadPart / 1000000));
|
||||||
#else
|
#else
|
||||||
*tv = time->tv;
|
*tv = time->tv;
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user