Skip to content

time.h: fix integer overflow in MsToAbsoluteTimespec() on 32-bit architectures #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 5, 2022
Merged
Prev Previous commit
Next Next commit
app/src/time.h: use modulo operator
  • Loading branch information
dconeybe committed Aug 5, 2022
commit b104910a3651088f4da289ae63b865f70d35569a
2 changes: 1 addition & 1 deletion app/src/time.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ inline timespec MsToAbsoluteTimespec(int milliseconds) {
(milliseconds * internal::kNanosecondsPerMillisecond);

t.tv_sec = nanoseconds / internal::kNanosecondsPerSecond;
t.tv_nsec = nanoseconds - (t.tv_sec * internal::kNanosecondsPerSecond);
t.tv_nsec = nanoseconds % internal::kNanosecondsPerSecond;
return t;
}

Expand Down