Commit 7c523501 authored by Dominik Charousset's avatar Dominik Charousset

Simplify render_date

parent 96985a44
......@@ -348,13 +348,7 @@ void logger::render_time_diff(std::ostream& out, timestamp t0, timestamp tn) {
}
void logger::render_date(std::ostream& out, timestamp x) {
auto y = std::chrono::time_point_cast<timestamp::clock::duration>(x);
auto z = timestamp::clock::to_time_t(y);
// strftime workaround: std::put_time not available on GCC 4.8
// out << std::put_time(std::localtime(&z), "%F %T");
char buf[50];
if (strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", std::localtime(&z)))
out << buf;
out << deep_to_string(x);
}
void logger::render(std::ostream& out, const line_format& lf,
......
......@@ -106,7 +106,7 @@ CAF_TEST(rendering) {
time_t t0_t = 0;
char t0_buf[50];
CAF_REQUIRE(strftime(t0_buf, sizeof(t0_buf),
"%Y-%m-%d %H:%M:%S", localtime(&t0_t)));
"%Y-%m-%dT%H:%M:%S.000", localtime(&t0_t)));
CAF_CHECK_EQUAL(render(logger::render_date, t0), t0_buf);
// Rendering of events.
logger::event e{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment