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:
Wladimir J. van der Laan
2014-05-08 18:01:10 +02:00
parent a60838d09a
commit 3e8ac6af9a
4 changed files with 15 additions and 20 deletions

View File

@@ -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)
{