Package dev.deepcore.challenge.session
Class SessionTimingState
java.lang.Object
dev.deepcore.challenge.session.SessionTimingState
Tracks run start and paused-duration timing values for a session.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbeginPause(long pausedAtMillis) Marks the timestamp when pause started.voidbeginRun(long startedAtMillis) Starts run timing at the provided millisecond timestamp.longReturns total accumulated paused duration in milliseconds.longReturns pause start timestamp in milliseconds.longReturns run start timestamp in milliseconds.voidreset()Resets all tracked timing values to zero.voidresume(long resumedAtMillis) Resumes run timing and accumulates elapsed paused duration.
-
Constructor Details
-
SessionTimingState
public SessionTimingState()
-
-
Method Details
-
reset
public void reset()Resets all tracked timing values to zero. -
beginRun
public void beginRun(long startedAtMillis) Starts run timing at the provided millisecond timestamp.- Parameters:
startedAtMillis- timestamp in milliseconds when the run began
-
beginPause
public void beginPause(long pausedAtMillis) Marks the timestamp when pause started.- Parameters:
pausedAtMillis- timestamp in milliseconds when pause began
-
resume
public void resume(long resumedAtMillis) Resumes run timing and accumulates elapsed paused duration.- Parameters:
resumedAtMillis- timestamp in milliseconds when run resumed
-
getRunStartMillis
public long getRunStartMillis()Returns run start timestamp in milliseconds.- Returns:
- run start epoch timestamp in milliseconds
-
getPausedStartedMillis
public long getPausedStartedMillis()Returns pause start timestamp in milliseconds.- Returns:
- pause start epoch timestamp in milliseconds, or zero when not paused
-
getAccumulatedPausedMillis
public long getAccumulatedPausedMillis()Returns total accumulated paused duration in milliseconds.- Returns:
- total paused duration accumulated across all pause intervals
-