refactor(timer): elapsed is active time from start

This commit is contained in:
Carlos Valente
2026-06-28 19:12:22 +02:00
committed by Carlos Valente
parent 4f4626a163
commit 161ab3fe13
12 changed files with 196 additions and 6 deletions
@@ -760,6 +760,7 @@ function broadcastResult(_target: any, _propertyKey: string, descriptor: Propert
startedAt: state.timer.startedAt,
addedTime: state.timer.addedTime,
pausedAt: state._timer.pausedAt,
pausedDuration: state._timer.pausedDuration,
firstStart: state.rundown.actualStart,
startEpoch: state._startEpoch,
currentDay: state.rundown.currentDay,
@@ -33,7 +33,8 @@ export function getShouldClockUpdate(previousUpdate: number, now: number): boole
* Checks whether we should update the timer values
* - `current` and `secondaryTimer` trigger on seconds roll over
* - the rest trigger on any change
* - `elapsed` and `expectedFinish` is not checked
* - `elapsed` changes alongside `current`
* - `expectedFinish` is not checked
*/
export function getShouldTimerUpdate(previousValue: TimerState | undefined, currentValue: TimerState): boolean {
if (previousValue === undefined) return true;
@@ -48,7 +49,7 @@ export function getShouldTimerUpdate(previousValue: TimerState | undefined, curr
previousValue.phase !== currentValue.phase ||
previousValue.playback !== currentValue.playback ||
previousValue.startedAt !== currentValue.startedAt
// elapsed - this would be the direct invert of current value so no need to check
// elapsed - this is derived from current / duration / addedTime, so the fields above cover it
// expectedFinish - this will be moved out by the current value going into over time, no need to check
);
}