ros2 / rmw_dds_common

Apache License 2.0
11 stars 20 forks source link

Create a utility function to limit rmw_time_t to 32-bit values #37

Closed mjeronimo closed 3 years ago

mjeronimo commented 4 years ago

The RMW layer maintains the rmw_time_t's seconds and nanoseconds values as 64-bit unsigned integers. However, the DDS standard specifies the Time_t and Duration_t types with "long sec" and "unsigned long nanosec", and the IDL to C++11 mapping states that the C++ types for long and unsigned long are mapped to int32_t and uint32_t, respectively. This difference can result in the seconds (and/or nanoseconds) value being truncated and incorrect, causing other downstream failures. This function can be used in different RMW adaptation layers that interface to the DDS providers when converting from rmw_time_to to the DDS Duration_t (or Time_t), such as rmw_time_to_fast_rtps.

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

mjeronimo commented 3 years ago