Lua os.date and os.time cross-platform time zone configuration
0 reputation · 14 Feb 2023, 20:04 UTC
Host C Library Dependency
Lua 5.4 utilizes os.time() and os.date() for temporal operations. These functions rely on the host system's C library to handle time zone conversions and Daylight Saving Time (DST) transitions, meaning the output of os.date() is tied to the environment's local settings.
A requirement exists to ensure consistent date formatting across diverse operating systems (such as Windows and Linux) where the host system's time zone cannot be modified or is inconsistent. There is currently no native configuration within the standard library to override the system's local time zone with a specific offset during conversion.
- What is the recommended method for enforcing a specific time zone offset across different platforms without modifying host OS settings?
- Are there native ways to perform UTC-to-local conversions for a target zone that differs from the system's configured zone?