-
Notifications
You must be signed in to change notification settings - Fork 9
Description
What's needed?
The current timer fires interval time after the ready() method was called, but this is not suitable for periodic timers as it will accumulate timer drift over time.
We need a timer that will periodically fire every interval time.
Proposed solution
Extend Timer to have a periodic option or create a new PeriodicTimer that will start when the timer is instantiated and will fire periodically every interval time, no matter if ready() was called or not.
If the timer fired several times before ready()/consume() was called, those fires should be queued and returned eventually.
Use cases
The resampler needs this.
Alternatives and workarounds
One could use the current Timer and account for the time drifting oneself. But for that we need to create a new timer for each period, which is wasteful in terms of resources (allocations) and inconvenient in terms of programming effort.