Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

sharminramli
Copy link
Contributor

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 #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 #2507.

Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this is right thing to do.

@clalancette @wjwwood what do you think?

Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Signed-off-by: Nursharmin Ramli <nursharminramli@gmail.com>
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me with green CI.

Let's put this on the queue to merge once Rolling is unfrozen.

@ahcorde
Copy link
Contributor

ahcorde commented Apr 23, 2024

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Windows Build Status

@ahcorde
Copy link
Contributor

ahcorde commented Apr 23, 2024

@clalancette can we backport this to jazzy ? or we should wait the frozen period?

@clalancette
Copy link
Contributor

@clalancette can we backport this to jazzy ? or we should wait the frozen period?

We are open for backports now. My only question is whether we should actually backport it to Jazzy or not. We are not allowing new features into Jazzy, but we are allowing bugfixes. The other thing we want to avoid at this point is too much breakage to downstream packages.

What do you think @ahcorde ? Do you consider this a bugfix or a feature, and what do you think the downstream impact is going to be?

@fujitatomoya
Copy link
Collaborator

@clalancette @ahcorde IMO, this could possibly break the user application. so i would not backport this to released distros...

@ahcorde ahcorde merged commit de666d2 into ros2:rolling Apr 23, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rclcpp::Time(int64_t nanoseconds, ...) should check for negative time
5 participants