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;