Skip to content

Commit

Permalink
rclcpp::Time(int64_t nanoseconds, ...) should check for negative time
Browse files Browse the repository at this point in the history
  ros2/rclcpp#2507

Signed-off-by: Tomoya Fujita <[email protected]>
  • Loading branch information
fujitatomoya committed Apr 17, 2024
1 parent 5beec96 commit 886f1da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions prover_rclcpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ custom_executable(rclcpp_2379)
custom_executable(rclcpp_2417_pub)
custom_executable(rclcpp_2417_sub)
custom_executable(rclcpp_2497)
custom_executable(rclcpp_2507)

custom_executable(rosbag2_1586)

Expand Down
10 changes: 10 additions & 0 deletions prover_rclcpp/src/rclcpp_2507.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "rclcpp/rclcpp.hpp"

int main(void)
{
RCLCPP_INFO_STREAM(rclcpp::get_logger(""), "Negative rclcpp::Time with int64_t ns");
const auto negative_ns = rclcpp::Time(-1);
RCLCPP_INFO_STREAM(rclcpp::get_logger(""), "Negative rclcpp::Time with int32_t s, uint32_t ns");
const auto negative_s_ns = rclcpp::Time(-1, 0);
return 0;
}

0 comments on commit 886f1da

Please sign in to comment.