Skip to content

Commit

Permalink
Change timer beginning behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackie Kay committed Nov 6, 2015
1 parent ca64af3 commit dcd5117
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions rclcpp/include/rclcpp/timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,8 @@ class GenericTimer : public TimerBase
GenericTimer(std::chrono::nanoseconds period, CallbackType callback)
: TimerBase(period, callback), loop_rate_(period)
{
/* Subtracting the loop rate period ensures that the callback gets triggered
on the first call to check_and_trigger. */
last_triggered_time_ = Clock::now() - period;
/* Set last_triggered_time_ so that the timer fires at least one period after being created. */
last_triggered_time_ = Clock::now();
}

/// Default destructor.
Expand Down

0 comments on commit dcd5117

Please sign in to comment.