Documentation Index
Fetch the complete documentation index at: https://mintlify.com/LiveSplit/livesplit-core/llms.txt
Use this file to discover all available pages before exploring further.
livesplit-core uses two small enums to describe the state of the timer at any point: TimerPhase describes what stage of an attempt the timer is in, and TimingMethod describes which clock is being used to measure time.
TimerPhase
TimerPhase describes which phase the timer is currently in.
| Variant | Value | Description |
|---|
NotRunning | 0 | No attempt is currently in progress. The timer is idle. |
Running | 1 | An attempt is active and the timer is counting up. |
Ended | 2 | The final split was recorded; the run is finished but not yet reset. |
Paused | 3 | An attempt is in progress but the timer is paused. |
State Transitions
| From | Action | To |
|---|
NotRunning | start() | Running |
Running | split() on last split | Ended |
Running | pause() | Paused |
Paused | resume() | Running |
Ended | undo_split() | Running |
Running or Paused or Ended | reset() | NotRunning |
Helper Methods
TimerPhase provides convenience methods for pattern-matching-free checks:
timer.current_phase().is_not_running(); // true if NotRunning
timer.current_phase().is_running(); // true if Running
timer.current_phase().is_ended(); // true if Ended
timer.current_phase().is_paused(); // true if Paused
Usage Example
use livesplit_core::TimerPhase;
match timer.current_phase() {
TimerPhase::NotRunning => {
println!("Press Start to begin your run");
}
TimerPhase::Running => {
println!("Run in progress — press Split to record a segment");
}
TimerPhase::Paused => {
println!("Run paused — press Resume to continue");
}
TimerPhase::Ended => {
println!("Run finished! Reset to start a new attempt");
}
}
TimingMethod
TimingMethod controls which form of time is used for splits and comparisons.
| Variant | Value | Description |
|---|
RealTime | 0 | Wall-clock time from an atomic-clock-accurate source. Always available. |
GameTime | 1 | Time provided by the game (e.g., in-game timer or real time minus loads). Must be initialized and set explicitly. |
RealTime
Real Time is always active once an attempt starts. It cannot be paused separately from the overall timer pause, and it always increments at the same rate as the wall clock.
GameTime
Game Time is optional and must be explicitly initialized for each attempt with timer.initialize_game_time(). After initialization, it can be:
- Set directly:
timer.set_game_time(time_span)
- Derived from loading times:
timer.set_loading_times(loads) — game time becomes real_time - loading_times
- Paused/resumed independently:
timer.pause_game_time() / timer.resume_game_time()
Game Time is automatically deinitialized when the attempt is reset.
use livesplit_core::{TimingMethod, TimeSpan};
// Switch to game time display
timer.set_current_timing_method(TimingMethod::GameTime);
// Or toggle between real and game time
timer.toggle_timing_method();
// Check which method is active
if timer.current_timing_method() == TimingMethod::GameTime {
// Initialize and update game time
timer.initialize_game_time().unwrap();
timer.set_game_time(TimeSpan::from_seconds(95.5)).unwrap();
}
Use TimingMethod::GameTime when your game has loads that should not count toward the official time, or when the game exposes an in-game timer. Runners can always compare against both timing methods in the splits display.