diff --git a/lib/timeutil.c b/lib/timeutil.c index 12d5fbe0..0ee5004e 100644 --- a/lib/timeutil.c +++ b/lib/timeutil.c @@ -222,10 +222,10 @@ convert_timespec(clockid_t from_id, clockid_t to_id, uint64_t timespec_to_ms(const struct timespec *tv) { - if (UINT64_MAX / 1000 < tv->tv_sec) { + if (UINT64_MAX / 1000 < (uint64_t)tv->tv_sec) { return UINT64_MAX; } - uint64_t ms1 = tv->tv_sec * 1000; + uint64_t ms1 = (uint64_t)tv->tv_sec * 1000; uint64_t ms2 = tv->tv_nsec / 1000000; if (UINT64_MAX - ms1 < ms2) { return UINT64_MAX;