]> sigrok.org Git - libserialport.git/commitdiff
windows: Fix a warning on conversion to unsigned int.
authorMartin Ling <redacted>
Fri, 24 Jan 2020 05:03:49 +0000 (05:03 +0000)
committerUwe Hermann <redacted>
Sun, 26 Jan 2020 20:11:46 +0000 (21:11 +0100)
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.

timing.c

index 3a5f5c73086d6e61fd292d5e7653c984cf42fe66..25876d622c9a17edd37f54fc8d498c5e01e42b16 100644 (file)
--- a/timing.c
+++ b/timing.c
@@ -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