What is the Windows equivalent of the Unix function gmtime_r? What is the Windows equivalent of the Unix function gmtime_r? unix unix

What is the Windows equivalent of the Unix function gmtime_r?


gmtime_r() is the thread-safe version of gmtime(). The MSVC implementation of gmtime() is already thread safe, the returned struct tm* is allocated in thread-local storage.

That doesn't make it immune from trouble if the function is called multiple times on the same thread and the returned pointer is stored. You can use gmtime_s() instead. Closest to gmtime_r() but with the arguments reversed ;)