Skip to content

Commit

Permalink
Use RCUTILS_NS_TO_S
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Oct 12, 2022
1 parent 232dd5a commit 4473a1d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fuse_core/src/uuid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ UUID generate(const std::string& namespace_string, const rclcpp::Time& stamp)
// replicate ros1 behaviour for now
#warning "deprecated time API"
rcl_time_point_value_t stamp_val = stamp.nanoseconds();
int32_t stamp_s = stamp_val / (rcl_time_point_value_t)1e9;
int32_t stamp_ns = stamp_val % (rcl_time_point_value_t)1e9;
int32_t stamp_s = RCUTILS_NS_TO_S(stamp_val);
int32_t stamp_ns = stamp_val % (1000LL * 1000LL * 1000LL);

constexpr size_t buffer_size = sizeof(stamp_s) + sizeof(stamp_ns);
std::array<unsigned char, buffer_size> buffer;
Expand All @@ -86,8 +86,8 @@ UUID generate(const std::string& namespace_string, const rclcpp::Time& stamp, co
// replicate ros1 behaviour for now
#warning "deprecated time API"
rcl_time_point_value_t stamp_val = stamp.nanoseconds();
int32_t stamp_s = stamp_val / (rcl_time_point_value_t)1e9;
int32_t stamp_ns = stamp_val % (rcl_time_point_value_t)1e9;
int32_t stamp_s = RCUTILS_NS_TO_S(stamp_val);
int32_t stamp_ns = stamp_val % (1000LL * 1000LL * 1000LL);

constexpr size_t buffer_size = sizeof(stamp_s) + sizeof(stamp_ns) + UUID::static_size();
std::array<unsigned char, buffer_size> buffer;
Expand Down

0 comments on commit 4473a1d

Please sign in to comment.