Merge pull request #4880

96e6b439 blockchain_stats: don't use gmtime_r on Windows (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-12-04 17:29:46 +02:00
commit d4a0fb2b89
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
4 changed files with 13 additions and 12 deletions

View file

@ -234,7 +234,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
}
time_t tt = blk.timestamp;
char timebuf[64];
gmtime_r(&tt, &currtm);
epee::misc_utils::get_gmt_time(tt, currtm);
if (!prevtm.tm_year)
prevtm = currtm;
// catch change of day

View file

@ -6731,11 +6731,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);