C++11 alternative to localtime_r
You’re not missing anything. The next C standard (due out probably this year) does have defined in Annex K: struct tm *localtime_s(const time_t * restrict timer, struct tm * restrict result); And this new function is thread safe! But don’t get too happy. There’s two major problems: localtime_s is an optional extension to C11. C++11 …