core/utils/clamped_clock library

Properties

clockRewindBlockedCount ↔ int
A "never goes backward" clock — a monotonic day/ms clock shared by every time-based reward system (daily reward, streaks, season...). It's a standalone helper here, rather than logic scattered across each place that needs it, so every date-based reward system goes through the same protection layer.
getter/setter pair
debugTimeOffsetMs → int
The debug-only offset currently added to the real wall clock by every nowMsClamped/todayEpochDayClamped read — always 0 unless setDebugTimeOffsetMs was called. Exposed read-only for a debug/QA panel to show the current "time travel" state.
no setter

Functions

nowMsClamped([StorageService? storage]) → int
Current millisecond timestamp, clamped to never go below the largest value seen so far.
setDebugTimeOffsetMs(int offsetMs) → void
Sets the debug-only offset nowMsClamped/todayEpochDayClamped add to the real wall clock before every read — FEAT-93's DebugQaOverlay "Time Travel" tab, letting a QA tester see a time-gated system (Daily Login/ Quest/Energy/Season Event) react to +2h/+24h/+7d without touching the OS clock (which routinely causes unwanted side effects elsewhere on the device). A no-op outside kDebugMode/kProfileMode — same posture as dlog (debug_log.dart) — so nothing outside an already debug-gated UI can ever move this, and it's always exactly 0 in a release build.
todayEpochDayClamped() → int
Days since epoch (UTC), clamped to never go below the largest value seen so far.