From da7eee64a8eb5f897c8f212d070aa78f2ef5480f Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 16 Sep 2019 09:50:59 +0200 Subject: [PATCH] Fixes #282 : compilation error in MSVC --- utility.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utility.hpp b/utility.hpp index c1a787a..0c9ee9c 100644 --- a/utility.hpp +++ b/utility.hpp @@ -339,12 +339,14 @@ namespace SimpleWeb { auto time = std::chrono::system_clock::to_time_t(time_point); tm tm; #ifdef _MSC_VER - auto gmtime = gmtime_s(&time, &tm); + if(gmtime_s(&tm, &time) != 0) + return {}; + auto gmtime = &tm; #else auto gmtime = gmtime_r(&time, &tm); -#endif if(!gmtime) return {}; +#endif switch(gmtime->tm_wday) { case 0: result += "Sun, "; break;