Change timer beginning behavior
This commit is contained in:
parent
ca64af3145
commit
dcd5117f89
1 changed files with 2 additions and 3 deletions
|
@ -97,9 +97,8 @@ public:
|
||||||
GenericTimer(std::chrono::nanoseconds period, CallbackType callback)
|
GenericTimer(std::chrono::nanoseconds period, CallbackType callback)
|
||||||
: TimerBase(period, callback), loop_rate_(period)
|
: TimerBase(period, callback), loop_rate_(period)
|
||||||
{
|
{
|
||||||
/* Subtracting the loop rate period ensures that the callback gets triggered
|
/* Set last_triggered_time_ so that the timer fires at least one period after being created. */
|
||||||
on the first call to check_and_trigger. */
|
last_triggered_time_ = Clock::now();
|
||||||
last_triggered_time_ = Clock::now() - period;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Default destructor.
|
/// Default destructor.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue