From 854166364bd0c6102b9738a05b2caba4a02efa42 Mon Sep 17 00:00:00 2001 From: Schebb Date: Tue, 6 Jan 2015 13:23:53 +0100 Subject: [PATCH] fixed 'localtime_*' compilation error MinGW --- websocketpp/common/time.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/websocketpp/common/time.hpp b/websocketpp/common/time.hpp index 0e06d04..571688e 100644 --- a/websocketpp/common/time.hpp +++ b/websocketpp/common/time.hpp @@ -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