From 0957760c42cc04d9c295b649b039015186b25609 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 5 Mar 2016 23:29:57 +0100 Subject: Replace clock_gettime with std::chrono for EDI --- src/dabOutput/edi/TagItems.cpp | 8 +++++++- src/dabOutput/edi/TagItems.h | 10 +++------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/dabOutput/edi') diff --git a/src/dabOutput/edi/TagItems.cpp b/src/dabOutput/edi/TagItems.cpp index f3e8404..54e996b 100644 --- a/src/dabOutput/edi/TagItems.cpp +++ b/src/dabOutput/edi/TagItems.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2013,2014 Matthias P. Braendli + Copyright (C) 2016 Matthias P. Braendli http://mpb.li EDI output. @@ -131,6 +131,12 @@ std::vector TagDETI::Assemble() return packet; } +void TagDETI::set_seconds(std::chrono::system_clock::time_point t) +{ + std::time_t posix_timestamp_1_jan_2000 = 946684800; + seconds = std::chrono::system_clock::to_time_t(t) - posix_timestamp_1_jan_2000; +} + std::vector TagESTn::Assemble() { diff --git a/src/dabOutput/edi/TagItems.h b/src/dabOutput/edi/TagItems.h index 50d5e99..6a8470b 100644 --- a/src/dabOutput/edi/TagItems.h +++ b/src/dabOutput/edi/TagItems.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2013,2014 Matthias P. Braendli + Copyright (C) 2016 Matthias P. Braendli http://mpb.li EDI output. @@ -30,6 +30,7 @@ #include "config.h" #include "Eti.h" #include +#include #include #include @@ -98,12 +99,7 @@ class TagDETI : public TagItem */ uint32_t seconds; - void set_seconds(struct timespec tv) - { - time_t posix_timestamp_1_jan_2000 = 946684800; - seconds = tv.tv_sec - posix_timestamp_1_jan_2000; - } - + void set_seconds(std::chrono::system_clock::time_point t); /* TSTA: Shall be the 24 least significant bits of the Time Stamp * (TIST) field from the STI-D(LI) Frame. The full definition for the -- cgit v1.2.3