Skip to content

Commit

Permalink
Fix unit conversion bug in to_timeval() (#24)
Browse files Browse the repository at this point in the history
Signed-off-by: ljuricic <[email protected]>
  • Loading branch information
LukaJuricic authored Oct 27, 2022
1 parent 8356e04 commit 76873db
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ros2_socketcan/src/socket_can_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ struct timeval to_timeval(const std::chrono::nanoseconds timeout) noexcept
constexpr auto BILLION = 1'000'000'000LL;
struct timeval c_timeout;
c_timeout.tv_sec = static_cast<decltype(c_timeout.tv_sec)>(count / BILLION);
c_timeout.tv_usec = static_cast<decltype(c_timeout.tv_usec)>((count % BILLION) * 1000LL);
c_timeout.tv_usec = static_cast<decltype(c_timeout.tv_usec)>((count % BILLION) / 1000LL);

return c_timeout;
}
Expand Down

0 comments on commit 76873db

Please sign in to comment.