mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
The engine's OS millisecond counter (FUN_OS_TICKCOUNT_MS, same epoch GetTime() scales by 0.001) is unsigned and wraps at 2^32 ms. Nine files each re-derived the reader; several stored the tick into a signed int, so past 2^31 ms (~24.9 days uptime) every timestamp went negative and `startTime + duration` landed in the past -- callers saw every cooldown, aura, and lockout as already elapsed. The same bug shipped three times (the cooldown by-ID getters and C_LossOfControl). Add one source of truth -- Time::Clock (src/time/Clock.h) -- with a uint32 NowMs() and wrap-safe Reached/Remaining/Elapsed helpers, and route every tick reader through it. No module re-derives the reader or hand- rolls a `now < deadline` compare (which inverts across the wrap) anymore. Also fixes the reported cooldown/LoC getters (unsigned out-params, wrap-safe compares) and three latent instances of the same `now < end` inversion found while sweeping: totem/Tracker's two timer getters and aura/Source's cache-eviction pass. Named Time::Clock, not Time::Tick, because a Time::Tick inner name shadows the global Tick namespace (the WorldTick hook) from inside any Time::* file. Discovered by fuffc in #17.