Skip to content

Commit

Permalink
Merge pull request #146 from ros2/fix_timer
Browse files Browse the repository at this point in the history
Change behavior of timer on construction
  • Loading branch information
jacquelinekay committed Nov 6, 2015
2 parents ca64af3 + dcd5117 commit 361faf6
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 361faf6

Please sign in to comment.