Fix bug in ros::Duration::fromNSec that was introduced in https://github.com/ros/roscpp_core/pull/61, where conversions from nsec were not normalized properly, and could result in Durations with a negative nsec component, which then failed to compare properly.
Since the operator- also uses fromNSec, this also resulted in cases where the diff of two durations could result in an invalid duration.
Added tests which exposed this bug, and then re-added the normalization, which fixes it.
Fix bug in
ros::Duration::fromNSec
that was introduced in https://github.com/ros/roscpp_core/pull/61, where conversions from nsec were not normalized properly, and could result inDuration
s with a negative nsec component, which then failed to compare properly.Since the
operator
- also usesfromNSec
, this also resulted in cases where the diff of two durations could result in an invalid duration.Added tests which exposed this bug, and then re-added the normalization, which fixes it.