mlog: probable fix for gmtime_r not being available on windows

This commit is contained in:
moneromooo-monero 2017-02-04 11:47:41 +00:00
parent b01990124e
commit c3d7a198bf
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 6 additions and 1 deletions

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);