Skip to content
  • Ondřej Surý's avatar
    Add C11 localtime_r and gmtime_r shims for Windows · 08f4c7d6
    Ondřej Surý authored and Evan Hunt's avatar Evan Hunt committed
    On Windows, C11 localtime_r() and gmtime_r() functions are not
    available.  While localtime() and gmtime() functions are already thread
    safe because they use Thread Local Storage, it's quite ugly to #ifdef
    around every localtime_r() and gmtime_r() usage to make the usage also
    thread-safe on POSIX platforms.
    
    The commit adds wrappers around Windows localtime_s() and gmtime_s()
    functions.
    
    NOTE: The implementation of localtime_s and gmtime_s in Microsoft CRT
    are incompatible with the C standard since it has reversed parameter
    order and errno_t return type.
    08f4c7d6