added thread safety to std::localtime