Skip to content

Commit

Permalink
appease -Wtautological-constant-out-of-range-compare
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Jun 20, 2023
1 parent 5641da1 commit 87f22d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/timeutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 87f22d8

Please sign in to comment.