From b444a31cba3f4913ab86878f84c2a45eb0b9bce1 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 30 Oct 2019 12:08:43 +0100 Subject: Pull code from common commit 67a62df, replacing put_time --- lib/edi/common.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/edi') diff --git a/lib/edi/common.cpp b/lib/edi/common.cpp index ac8ec0c..d6ca89c 100644 --- a/lib/edi/common.cpp +++ b/lib/edi/common.cpp @@ -22,7 +22,6 @@ #include "buffer_unpack.hpp" #include "Log.h" #include "crc.h" -#include #include #include #include @@ -48,8 +47,14 @@ string frame_timestamp_t::to_string() const else { ss << "Timestamp not valid: "; } - ss << std::put_time(std::gmtime(&seconds_in_unix_epoch), "%c %Z") << - " + " << ((double)tsta / 16384000.0); + + char timestr[100]; + if (std::strftime(timestr, sizeof(timestr), "%Y-%m-%dZ%H:%M:%S", std::gmtime(&seconds_in_unix_epoch))) { + ss << timestr << " + " << ((double)tsta / 16384000.0); + } + else { + ss << "unknown"; + } return ss.str(); } -- cgit v1.2.3