Merge pull request #1670

c3d7a198 mlog: probable fix for gmtime_r not being available on windows (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-02-04 17:28:23 +02:00
commit 9547e79af5
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -43,7 +43,12 @@ static std::string generate_log_filename(const char *base)
char tmp[200];
struct tm tm;
time_t now = time(NULL);
if (!gmtime_r(&now, &tm))
if
#ifdef WIN32
(!gmtime_s(&tm, &now))
#else
(!gmtime_r(&now, &tm))
#endif
strcpy(tmp, "unknown");
else
strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm);