Skip to content

Commit

Permalink
Use new time_utils function to limit rmw_time_t values to 32-bits (#485)
Browse files Browse the repository at this point in the history
* Use new time_utils function to limit rmw_time_t values to 32-bits

Full description here:

ros2/rmw_dds_common@86384ff

Signed-off-by: Michael Jeronimo <michael.jeronimo@openrobotics.org>

* Use an explicit type to avoid potential misunderstandings about the operation

Signed-off-by: Michael Jeronimo <michael.jeronimo@openrobotics.org>
  • Loading branch information
mjeronimo authored Nov 13, 2020
1 parent 091a2db commit 47be8ba
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rmw_fastrtps_shared_cpp/src/qos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@
#include "fastrtps/attributes/SubscriberAttributes.h"

#include "rmw/error_handling.h"
#include "rmw_dds_common/time_utils.hpp"

static
eprosima::fastrtps::Duration_t
rmw_time_to_fastrtps(const rmw_time_t & time)
{
rmw_time_t clamped_time = rmw_dds_common::clamp_rmw_time_to_dds_time(time);
return eprosima::fastrtps::Duration_t(
static_cast<int32_t>(time.sec),
static_cast<uint32_t>(time.nsec));
static_cast<int32_t>(clamped_time.sec),
static_cast<uint32_t>(clamped_time.nsec));
}

static
Expand Down

0 comments on commit 47be8ba

Please sign in to comment.