diff --git a/src/utiltime.cpp b/src/utiltime.cpp index 6e819e7af..17d51a2d6 100644 --- a/src/utiltime.cpp +++ b/src/utiltime.cpp @@ -50,8 +50,9 @@ void MilliSleep(int64_t n) std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime) { + static std::locale classic(std::locale::classic()); // std::locale takes ownership of the pointer - std::locale loc(std::locale::classic(), new boost::posix_time::time_facet(pszFormat)); + std::locale loc(classic, new boost::posix_time::time_facet(pszFormat)); std::stringstream ss; ss.imbue(loc); ss << boost::posix_time::from_time_t(nTime);