diff --git a/rclcpp/include/rclcpp/rate.hpp b/rclcpp/include/rclcpp/rate.hpp index 884e462a76..381e8d7908 100644 --- a/rclcpp/include/rclcpp/rate.hpp +++ b/rclcpp/include/rclcpp/rate.hpp @@ -163,7 +163,7 @@ class Rate : public RateBase reset(); RCLCPP_PUBLIC - Duration + std::chrono::nanoseconds period() const; private: diff --git a/rclcpp/src/rclcpp/rate.cpp b/rclcpp/src/rclcpp/rate.cpp index 04a1f57185..9a6e3d486b 100644 --- a/rclcpp/src/rclcpp/rate.cpp +++ b/rclcpp/src/rclcpp/rate.cpp @@ -14,6 +14,7 @@ #include "rclcpp/rate.hpp" +#include #include namespace rclcpp @@ -87,10 +88,10 @@ Rate::reset() last_interval_ = clock_->now(); } -Duration +std::chrono::nanoseconds Rate::period() const { - return period_; + return std::chrono::nanoseconds(period_.nanoseconds()); } WallRate::WallRate(const double rate)