Skip to content

elapsedSecondsAt

elapsedSecondsAt(timing, nowMs): number

Defined in: console-sdk/src/session/timing.ts:30

Working seconds elapsed at nowMs, excluding pause spans — the pure math behind TimingSnapshot.elapsedSeconds. An open pause (to: null) counts up to nowMs, so the value FREEZES while paused; a finished session (endedAt set) ignores nowMs. Clamped at 0 before the session starts.

Consumers already hold a TimingSnapshot on the session snapshot; only startedAt / endedAt / pauses are read (the snapshot’s own baked elapsedSeconds is ignored, since it was computed at an earlier instant). Pass Date.now() for a live reading; repaint on your own interval for a smooth clock.

Pick<TimingSnapshot, "startedAt" | "endedAt" | "pauses">

number

number