diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 20b0496cc..f878eb7b3 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -423,8 +423,9 @@ std::string getNowTimeStr(const char* format) { char tmpStr[256]; struct timeval tv; + struct tm t; gettimeofday(&tv, NULL); - strftime(tmpStr, sizeof(tmpStr), format, localtime(&tv.tv_sec)); + strftime(tmpStr, sizeof(tmpStr), format, localtime_r(&tv.tv_sec, &t)); return (std::string)tmpStr; }