-
Notifications
You must be signed in to change notification settings - Fork 522
Closed
Description
Bug report
Required Info:
- Operating System:
- Ubuntu 22.04
- Installation type:
- binaries (apt)
- Version or commit hash:
- ros-iron-rclcpp/jammy,now 21.0.5-1jammy.20240213.155845 amd64
- DDS implementation:
- default
- Client library (if applicable):
- rclcpp
Steps to reproduce issue
Create a dummy node with the following:
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);
Expected behavior
Both negative_ns and negative_s_ns should throw.
Actual behavior
negative_ns does not throw, only negative_s_ns does:
[INFO] [1713275443.003549819] []: Negative rclcpp::Time with int64_t ns
[INFO] [1713275443.003577744] []: Negative rclcpp::Time with int32_t s, uint32_t ns
terminate called after throwing an instance of 'std::runtime_error'
what(): cannot store a negative time point in rclcpp::Time
[ros2run]: Aborted
Additional information
Feature request
Feature description
Adding the <0 check
rclcpp/rclcpp/src/rclcpp/time.cpp
Line 52 in 535d56f
| if (seconds < 0) { |
to
rclcpp/rclcpp/src/rclcpp/time.cpp
Line 60 in 535d56f
| Time::Time(int64_t nanoseconds, rcl_clock_type_t clock_type) |
I would be happy to implement this change if this is indeed a missing feature.
Implementation considerations
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels