bubbles
bubbles copied to clipboard
Timer: fix duplicate ticks when stopping and starting fast
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.