Files
dusklight/src/dusk/game_clock.h
T
Luke Street 0f5a248401 Time revamp (#2304)
* Don't Use OSCalendarTime for Speedrun Timing

- Shouldn't rely on OSTicksToCalendarTime since it will be changed to handle time zone conversion, and that doesn't make sense on elapsed time

* Use OSGetSystemTime Extension

- Fixes desyncing issues with save file time and a couple other odd instances, particularly on mobile platforms that suspend apps

* Time revamp

* Update aurora

* Split IGT/RTA calculations

* Shift-Turbo to slow down

---------

Co-authored-by: SuperDude88 <82904174+SuperDude88@users.noreply.github.com>
2026-08-14 00:07:54 -06:00

32 lines
825 B
C++

#pragma once
namespace dusk::game_clock {
// Amount of time that a simulation tick advances
constexpr float kSimPeriod = 1.0f / 30.0f;
constexpr float kUiMaximumDt = 0.05f;
constexpr float kUiInitialDt = 1.0f / 60.0f;
struct FrameTiming {
// Amount of time elapsed in seconds since the last advance
float dt;
// Whether interpolation is active
bool interpolating;
// Run simulation and presentation separately (for interpolation or time scaling)
bool separatePresentation;
// Number of simulation ticks to run
int numSimTicks;
};
extern FrameTiming g_frameTiming;
void initialize();
void reset();
const FrameTiming& advance();
void begin_sim_tick();
void commit_sim_tick();
float sample_interpolation_step();
float consume_interval(const void* consumer);
} // namespace dusk::game_clock