Fixes #282 : compilation error in MSVC

This commit is contained in:
eidheim 2019-09-16 09:50:59 +02:00
commit da7eee64a8

View file

@ -339,12 +339,14 @@ namespace SimpleWeb {
auto time = std::chrono::system_clock::to_time_t(time_point); auto time = std::chrono::system_clock::to_time_t(time_point);
tm tm; tm tm;
#ifdef _MSC_VER #ifdef _MSC_VER
auto gmtime = gmtime_s(&time, &tm); if(gmtime_s(&tm, &time) != 0)
return {};
auto gmtime = &tm;
#else #else
auto gmtime = gmtime_r(&time, &tm); auto gmtime = gmtime_r(&time, &tm);
#endif
if(!gmtime) if(!gmtime)
return {}; return {};
#endif
switch(gmtime->tm_wday) { switch(gmtime->tm_wday) {
case 0: result += "Sun, "; break; case 0: result += "Sun, "; break;