mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-16 21:03:29 +00:00
fix: infer day offset from epoch
This commit is contained in:
committed by
Carlos Valente
parent
efd19353e9
commit
f1a1c358bc
@@ -545,10 +545,15 @@ export function update(): UpdateResult {
|
||||
return updateIfIdle();
|
||||
}
|
||||
|
||||
const hasCrossedMidnight = previousClock > now;
|
||||
// calculate currentDay from epoch (days elapsed since playback was started)
|
||||
if (runtimeState._startEpoch !== null && runtimeState._startDayOffset !== null) {
|
||||
const daysSinceStart = timeCore.daysSinceStart(runtimeState._startEpoch, epoch);
|
||||
runtimeState.rundown.currentDay = runtimeState._startDayOffset + daysSinceStart;
|
||||
}
|
||||
|
||||
// 2. are we waiting to roll?
|
||||
if (runtimeState.timer.playback === Playback.Roll && runtimeState.timer.secondaryTimer !== null) {
|
||||
const hasCrossedMidnight = previousClock > now;
|
||||
return updateIfWaitingToRoll(hasCrossedMidnight);
|
||||
}
|
||||
|
||||
@@ -556,11 +561,6 @@ export function update(): UpdateResult {
|
||||
// reset data
|
||||
runtimeState.timer.secondaryTimer = null;
|
||||
|
||||
// increment day if we crossed midnight
|
||||
if (hasCrossedMidnight && runtimeState.rundown.currentDay !== null) {
|
||||
runtimeState.rundown.currentDay++;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-labels -- dev code path
|
||||
DEV: {
|
||||
if (runtimeState.timer.duration === null) {
|
||||
|
||||
Reference in New Issue
Block a user