1
0
Fork 0

use std::chrono and std::date for date / time formatting (#5194)

This commit is contained in:
Wilfried Goesgens 2018-04-24 18:23:04 +02:00 committed by Jan
parent 468231efc5
commit ea507bb27c
1 changed files with 4 additions and 6 deletions

View File

@ -25,6 +25,7 @@
#include <velocypack/Iterator.h>
#include <velocypack/velocypack-aliases.h>
#include <date/date.h>
#include "ApplicationFeatures/ApplicationServer.h"
#include "Basics/ConditionLocker.h"
@ -1290,13 +1291,10 @@ void HeartbeatThread::logThreadDeaths(bool force) {
deadThreadsPosted = std::chrono::system_clock::now();
LOG_TOPIC(INFO, Logger::HEARTBEAT) << "HeartbeatThread ok.";
std::string buffer;
buffer.reserve(40);
for (auto const it : deadThreads) {
char buffer[40];
struct tm gmt;
time_t tt = std::chrono::system_clock::to_time_t(it.first);
gmtime_r(&tt, &gmt);
strftime(buffer, sizeof(buffer), "%FT%TZ", &gmt);
buffer = date::format("%FT%TZ", date::floor<std::chrono::milliseconds>(it.first));
LOG_TOPIC(ERR, Logger::HEARTBEAT) << "Prior crash of thread " << it.second
<< " occurred at " << buffer;