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

@ -6727,11 +6727,7 @@ static std::string get_human_readable_timestamp(uint64_t ts)
return "<unknown>";
time_t tt = ts;
struct tm tm;
#ifdef WIN32
gmtime_s(&tm, &tt);
#else
gmtime_r(&tt, &tm);
#endif
epee::misc_utils::get_gmt_time(tt, tm);
uint64_t now = time(NULL);
uint64_t diff = ts > now ? ts - now : now - ts;
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", &tm);