File tree Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Expand file tree Collapse file tree 2 files changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,8 @@ class TimersManager
106106 * @return true if head timer was ready at tp
107107 */
108108 bool execute_head_timer (
109- std::chrono::time_point<std::chrono::steady_clock> tp = TimePoint::max());
109+ std::chrono::time_point<std::chrono::steady_clock> tp =
110+ std::chrono::time_point<std::chrono::steady_clock>::max());
110111
111112 /* *
112113 * @brief Get the amount of time before the next timer expires.
@@ -133,8 +134,6 @@ class TimersManager
133134 // See https://en.cppreference.com/w/cpp/thread/condition_variable/wait_for
134135 static constexpr std::chrono::nanoseconds MAX_TIME = std::chrono::hours(90 );
135136
136- using TimePoint = std::chrono::time_point<std::chrono::steady_clock>;
137-
138137private:
139138 RCLCPP_DISABLE_COPY (TimersManager)
140139
Original file line number Diff line number Diff line change @@ -138,12 +138,10 @@ bool TimersManager::execute_head_timer(
138138
139139 bool timer_ready = false ;
140140
141- if (timepoint != TimePoint::max ()) {
142- // A ready timer will return a negative duration when calling time_until_trigger
143- auto timepoint_timer_ready = std::chrono::steady_clock::now () + head->time_until_trigger ();
141+ auto max_time = std::chrono::time_point<std::chrono::steady_clock>::max ();
144142
145- // Here we check if the timer was already ready at timepoint
146- timer_ready = timepoint_timer_ready < timepoint;
143+ if (timepoint != max_time) {
144+ timer_ready = timer_was_ready_at_tp (head, timepoint) ;
147145 } else {
148146 timer_ready = head->is_ready ();
149147 }
You can’t perform that action at this time.
0 commit comments