SDL monotonic ticks to local civil time conversion
0 reputation · 07 Oct 2024, 11:56 UTC
The goal is to convert SDL_GetTicks64 elapsed milliseconds into a regional wall-clock date-time for application logging and scheduled events.
SDL_GetTicks64 is a monotonic counter that starts at SDL initialization and has no relationship to the Unix epoch, an IANA time zone, or daylight saving rules. SDL provides no civil date formatting or time zone database access, so an external operating-system or library call is required. The unresolved decision is how to anchor SDL ticks to a specific wall-clock reference and which time zone source governs the conversion.
Should SDL initialization time be paired with a simultaneous system wall-clock timestamp to establish a stable offset? Which time zone source should take precedence when converting SDL ticks to local civil time? How should daylight saving time transitions be handled when the offset between monotonic ticks and wall-clock time changes?