1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

windows: Fix a warning on conversion to unsigned int.

The result should be safe because we only use this function on time
differences as part of timeout calculations, not on absolute times.

Add an explicit cast to suppress the warning.
This commit is contained in:
Martin Ling 2020-01-24 05:03:49 +00:00 committed by Uwe Hermann
parent 528e8c0002
commit 41fc921ce4

View File

@ -102,7 +102,7 @@ SP_PRIV unsigned int time_as_ms(const struct time *time)
#ifdef _WIN32
LARGE_INTEGER frequency;
QueryPerformanceFrequency(&frequency);
return time->ticks / (frequency.QuadPart / 1000);
return (unsigned int) (time->ticks / (frequency.QuadPart / 1000));
#else
return time->tv.tv_sec * 1000 + time->tv.tv_usec / 1000;
#endif