From 1c20782d6a37a5dc6f9dd295c21c30d05c1f7340 Mon Sep 17 00:00:00 2001 From: Manolis Surligas Date: Sun, 3 Dec 2017 23:24:17 +0200 Subject: [PATCH] Remove put_time() in favor of strftime() to support older gcc versions --- lib/multi_format_msg_sink_impl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/multi_format_msg_sink_impl.cc b/lib/multi_format_msg_sink_impl.cc index 64c97dd..b4589b8 100644 --- a/lib/multi_format_msg_sink_impl.cc +++ b/lib/multi_format_msg_sink_impl.cc @@ -48,13 +48,14 @@ namespace gr multi_format_msg_sink_impl::msg_handler_file (pmt::pmt_t msg) { uint8_t *su; + char buf[256]; std::string s ((const char *) pmt::blob_data (msg), pmt::blob_length (msg)); if(d_timestamp) { std::time_t t = std::time(nullptr); std::tm tm = *std::localtime(&t); - d_fos << "[" << std::put_time(&tm, "%F %T %z") << "] "; + d_fos << "[" << strftime(buf, sizeof(buf), "%F %T %z", &tm) << "]"; } switch (d_format) @@ -86,13 +87,14 @@ namespace gr multi_format_msg_sink_impl::msg_handler_stdout (pmt::pmt_t msg) { uint8_t *su; + char buf[256]; std::string s ((const char *) pmt::blob_data (msg), pmt::blob_length (msg)); if(d_timestamp) { std::time_t t = std::time(nullptr); std::tm tm = *std::localtime(&t); - std::cout << "[" << std::put_time(&tm, "%F %T %z") << "] "; + d_fos << "[" << strftime(buf, sizeof(buf), "%F %T %z", &tm) << "]"; } switch (d_format)