bubbles icon indicating copy to clipboard operation
bubbles copied to clipboard

Timer: fix duplicate ticks when stopping and starting fast

Open ailac22 opened this issue 3 years ago • 0 comments

When stopping and starting a timer fast (under 1s), tick chains duplicate because the previous emitted tick hasn't been dequeued yet in the timer's update function. When this happens the timer advances faster than clock speed.

I've sketched this solution in case it's an adequate solution (I've not thoroughly tested it though). Ticks include a cycleId number that changes each time a model is started. If the timer is stopped/started too fast, it will be detected in the Update function than one of the ticks was sent before stopping the timer.

ailac22 avatar Aug 15 '22 05:08 ailac22