Merge branch 'old-gcc-fix' into 'master'
Remove put_time() in favor of strftime() to support older gcc versions See merge request librespacefoundation/satnogs/gr-satnogs!122
This commit is contained in:
commit
73d68a7131
|
@ -48,13 +48,14 @@ namespace gr
|
||||||
multi_format_msg_sink_impl::msg_handler_file (pmt::pmt_t msg)
|
multi_format_msg_sink_impl::msg_handler_file (pmt::pmt_t msg)
|
||||||
{
|
{
|
||||||
uint8_t *su;
|
uint8_t *su;
|
||||||
|
char buf[256];
|
||||||
std::string s ((const char *) pmt::blob_data (msg),
|
std::string s ((const char *) pmt::blob_data (msg),
|
||||||
pmt::blob_length (msg));
|
pmt::blob_length (msg));
|
||||||
|
|
||||||
if(d_timestamp) {
|
if(d_timestamp) {
|
||||||
std::time_t t = std::time(nullptr);
|
std::time_t t = std::time(nullptr);
|
||||||
std::tm tm = *std::localtime(&t);
|
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)
|
switch (d_format)
|
||||||
|
@ -86,13 +87,14 @@ namespace gr
|
||||||
multi_format_msg_sink_impl::msg_handler_stdout (pmt::pmt_t msg)
|
multi_format_msg_sink_impl::msg_handler_stdout (pmt::pmt_t msg)
|
||||||
{
|
{
|
||||||
uint8_t *su;
|
uint8_t *su;
|
||||||
|
char buf[256];
|
||||||
std::string s ((const char *) pmt::blob_data (msg),
|
std::string s ((const char *) pmt::blob_data (msg),
|
||||||
pmt::blob_length (msg));
|
pmt::blob_length (msg));
|
||||||
|
|
||||||
if(d_timestamp) {
|
if(d_timestamp) {
|
||||||
std::time_t t = std::time(nullptr);
|
std::time_t t = std::time(nullptr);
|
||||||
std::tm tm = *std::localtime(&t);
|
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)
|
switch (d_format)
|
||||||
|
|
Loading…
Reference in New Issue