summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-10-30 12:08:54 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-10-30 12:08:54 +0100
commitcbefbb6f3cefd31cb9e8389638cd1301309579f8 (patch)
tree884711497d6c86cf2b73da9e4ca8026fa1730534
parent789dce2ee38a04d4b623a85d23a045f12f19240e (diff)
downloaddabmod-cbefbb6f3cefd31cb9e8389638cd1301309579f8.tar.gz
dabmod-cbefbb6f3cefd31cb9e8389638cd1301309579f8.tar.bz2
dabmod-cbefbb6f3cefd31cb9e8389638cd1301309579f8.zip
Pull code from common commit 67a62df, replacing put_time
-rw-r--r--lib/edi/common.cpp11
-rw-r--r--lib/edi/common.hpp1
2 files changed, 8 insertions, 4 deletions
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 <iomanip>
#include <sstream>
#include <cassert>
#include <cmath>
@@ -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();
}
diff --git a/lib/edi/common.hpp b/lib/edi/common.hpp
index 5d15f8d..8252a7a 100644
--- a/lib/edi/common.hpp
+++ b/lib/edi/common.hpp
@@ -46,7 +46,6 @@ struct frame_timestamp_t {
static frame_timestamp_t from_unix_epoch(std::time_t time, uint32_t tai_utc_offset, uint32_t tsta);
};
-
struct decode_state_t {
decode_state_t(bool _complete, size_t _num_bytes_consumed) :
complete(_complete), num_bytes_consumed(_num_bytes_consumed) {}