10#ifndef TIMER_GAME_REALTIME_H
11#define TIMER_GAME_REALTIME_H
38 std::chrono::milliseconds period;
41 TPeriod(std::chrono::milliseconds period,
Trigger trigger) : period(period), trigger(trigger) {}
48 constexpr auto operator<=>(
const TPeriod &other)
const noexcept
50 if (this->trigger != other.trigger)
return this->trigger <=> other.trigger;
51 return this->period <=> other.period;
59 constexpr bool operator==(
const TPeriod &other)
const noexcept
61 return this->trigger == other.trigger && this->period == other.period;
64 using TElapsed = std::chrono::milliseconds;
66 std::chrono::milliseconds elapsed;
Timer that represents real time for game-related purposes.
Trigger
When is the timer supposed to be run.
@ Autosave
Only run when not paused or there was a Command executed recently.
@ Always
Always run, even when paused.
@ Unpaused
Only run when not paused.
constexpr bool operator==(const TPeriod &other) const noexcept
Compare with another instance of this class.
constexpr auto operator<=>(const TPeriod &other) const noexcept
Compare with another instance of this class.