aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-05-08 18:01:10 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-05-23 15:23:11 +0200
commit3e8ac6af9a993e262d1160fb2e6e1e1f1d5d19f2 (patch)
treed6b1b2b531923e73bc5142693009d38b4a628d1a /src/util.h
parenta60838d09aed4d976e9343e8329d61afff204435 (diff)
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.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/util.h b/src/util.h
index 97185073e0..9e899b5084 100644
--- a/src/util.h
+++ b/src/util.h
@@ -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)
{