// DragonX Wallet - reentrant local-time helper (no per-call stat of /etc/localtime on glibc). #pragma once #include namespace dragonx::util { // Fills `out` with the local broken-down time of `t`. Returns false on failure. Thread-safe. inline bool localTime(std::time_t t, std::tm& out) { #ifdef _WIN32 return localtime_s(&out, &t) == 0; #else return localtime_r(&t, &out) != nullptr; #endif } // Re-read the TZ database / TZ env (glibc localtime_r does not do this on its own after the first call). // Call once per cache rebuild, never per item. inline void refreshTimezone() { #ifdef _WIN32 _tzset(); #else tzset(); #endif } } // namespace dragonx::util