rclcpp icon indicating copy to clipboard operation
rclcpp copied to clipboard

Check for negative time in rclcpp::Time(int64_t nanoseconds, ...) constructor

Open sharminramli opened this issue 1 year ago • 0 comments

rclcpp::Time currently allows a negative time when constructing with int64_t nanoseconds (but not with int32_t seconds even though both can possibly hold a negative value). For a more uniform interface and based off of https://github.com/ros2/rclcpp/issues/525 where time cannot be negative:

  • Added the negative time check and throw from the rclcpp::Time(int32_t seconds, uint32_t nanoseconds, ...) constructor to the rclcpp::Time(int64_t nanoseconds, ...) constructor
  • Added a test to check that it throws with negative time
  • Removed the tests which allowed for negative time (the cases should already be covered by the other tests?)

Closes https://github.com/ros2/rclcpp/issues/2507.

sharminramli avatar Apr 17 '24 14:04 sharminramli