fixed 'localtime_*' compilation error MinGW

This commit is contained in:
Schebb
2015-01-06 13:23:53 +01:00
parent 1517d646f9
commit 854166364b
+3 -1
View File
@@ -40,7 +40,9 @@ namespace lib {
/// Thread safe cross platform localtime
inline std::tm localtime(std::time_t const & time) {
std::tm tm_snapshot;
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
#if (defined(__MINGW32__) || defined(__MINGW64__))
memcpy(&tm_snapshot, ::localtime(&time), sizeof(std::tm));
#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
localtime_s(&tm_snapshot, &time);
#else
localtime_r(&time, &tm_snapshot); // POSIX