blockchain_stats: don't use gmtime_r on Windows

In some cases, it doesn't like it (I don't know the details).

Factor into a new epee function
This commit is contained in:
moneromooo-monero 2018-11-20 22:26:50 +00:00
parent 84dd674cd0
commit 96e6b43970
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
4 changed files with 13 additions and 12 deletions

View file

@ -40,6 +40,7 @@
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>
#include "string_tools.h"
#include "misc_os_dependent.h"
#include "misc_log_ex.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@ -58,12 +59,7 @@ static std::string generate_log_filename(const char *base)
char tmp[200];
struct tm tm;
time_t now = time(NULL);
if
#ifdef WIN32
(!gmtime_s(&tm, &now))
#else
(!gmtime_r(&now, &tm))
#endif
if (!epee::misc_utils::get_gmt_time(now, tm))
snprintf(tmp, sizeof(tmp), "part-%u", ++fallback_counter);
else
strftime(tmp, sizeof(tmp), "%Y-%m-%d-%H-%M-%S", &tm);