Replace non-threadsafe gmtime and setlocale
Make DateTimeStrFormat use boost::posix_time. Also re-enable the util_DateTimeStrFormat tests, as they are no longer platform specific.
This commit is contained in:
@@ -325,14 +325,7 @@ inline int64_t GetTimeMicros()
|
||||
boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_microseconds();
|
||||
}
|
||||
|
||||
inline std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
|
||||
{
|
||||
time_t n = nTime;
|
||||
struct tm* ptmTime = gmtime(&n);
|
||||
char pszTime[200];
|
||||
strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
|
||||
return pszTime;
|
||||
}
|
||||
std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);
|
||||
|
||||
inline bool IsSwitchChar(char c)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user