Add ScaledTickCounter type

This commit is contained in:
Jonathan G Rennison
2024-02-15 02:01:23 +00:00
parent c5f026ba66
commit edbbaeb5d9
3 changed files with 4 additions and 2 deletions

View File

@@ -28,7 +28,7 @@
#include "safeguards.h" #include "safeguards.h"
uint64_t _tick_counter; ///< Ever incrementing tick counter for setting off various events uint64_t _tick_counter; ///< Ever incrementing tick counter for setting off various events
uint64_t _scaled_tick_counter; ///< Tick counter in daylength-scaled ticks ScaledTickCounter _scaled_tick_counter; ///< Tick counter in daylength-scaled ticks
StateTicks _state_ticks; ///< Current state tick StateTicks _state_ticks; ///< Current state tick
uint32_t _quit_after_days; ///< Quit after this many days of run time uint32_t _quit_after_days; ///< Quit after this many days of run time

View File

@@ -14,7 +14,7 @@
#include "settings_type.h" #include "settings_type.h"
extern uint64_t _tick_counter; extern uint64_t _tick_counter;
extern uint64_t _scaled_tick_counter; extern ScaledTickCounter _scaled_tick_counter;
extern StateTicks _state_ticks; extern StateTicks _state_ticks;
extern uint32_t _quit_after_days; extern uint32_t _quit_after_days;

View File

@@ -29,6 +29,8 @@ static const int SECONDS_PER_DAY = 2; ///< approximate seconds per day, not
using Ticks = int32_t; ///< The type to store ticks in using Ticks = int32_t; ///< The type to store ticks in
static constexpr Ticks INVALID_TICKS = -1; ///< Representation of an invalid number of ticks static constexpr Ticks INVALID_TICKS = -1; ///< Representation of an invalid number of ticks
using ScaledTickCounter = uint64_t; ///< The type for the scaled tick counter
using YearDelta = StrongType::Typedef<int32_t, struct YearDeltaTag, StrongType::Compare, StrongType::IntegerScalable>; using YearDelta = StrongType::Typedef<int32_t, struct YearDeltaTag, StrongType::Compare, StrongType::IntegerScalable>;
using DateDelta = StrongType::Typedef<int32_t, struct DateDeltaTag, StrongType::Compare, StrongType::IntegerScalable>; using DateDelta = StrongType::Typedef<int32_t, struct DateDeltaTag, StrongType::Compare, StrongType::IntegerScalable>;
using DateTicksDelta = StrongType::Typedef<int64_t, struct DateTicksDeltaTag, StrongType::Compare, StrongType::IntegerScalable>; using DateTicksDelta = StrongType::Typedef<int64_t, struct DateTicksDeltaTag, StrongType::Compare, StrongType::IntegerScalable>;