From 2346b17f650e56f70046e95a54f356a8e3e29107 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 28 Jan 2019 11:13:54 +0100 Subject: EDI: correct value of ATST seconds field --- src/dabOutput/edi/TagItems.cpp | 10 ++++++---- src/dabOutput/edi/TagItems.h | 8 ++++---- 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 ed8517d..631b88d 100644 --- a/src/dabOutput/edi/TagItems.cpp +++ b/src/dabOutput/edi/TagItems.cpp @@ -132,12 +132,14 @@ std::vector TagDETI::Assemble() return packet; } -void TagDETI::set_seconds(std::chrono::system_clock::time_point t) +void TagDETI::set_edi_time(const std::chrono::system_clock::time_point& t, int tai_utc_offset) { - std::time_t posix_timestamp_1_jan_2000 = 946684800; - seconds = std::chrono::system_clock::to_time_t(t) - posix_timestamp_1_jan_2000; -} + utco = tai_utc_offset - 32; + + const std::time_t posix_timestamp_1_jan_2000 = 946684800; + seconds = std::chrono::system_clock::to_time_t(t) - posix_timestamp_1_jan_2000 + utco; +} std::vector TagESTn::Assemble() { diff --git a/src/dabOutput/edi/TagItems.h b/src/dabOutput/edi/TagItems.h index 19284d2..8666053 100644 --- a/src/dabOutput/edi/TagItems.h +++ b/src/dabOutput/edi/TagItems.h @@ -85,15 +85,15 @@ class TagDETI : public TagItem */ uint8_t utco = 0; - void set_tai_utc_offset(int tai_utc_offset) { utco = tai_utc_offset - 32; } + /* Update the EDI time. t is in UTC */ + void set_edi_time(const std::chrono::system_clock::time_point &t, int tai_utc_offset); /* The number of SI seconds since 2000-01-01 T 00:00:00 UTC as an - * unsigned 32-bit quantity + * unsigned 32-bit quantity. Contrary to POSIX, this value also + * counts leap seconds. */ uint32_t seconds = 0; - 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 * STI TIST can be found in annex B of EN 300 797 [4]. The most -- cgit v1.2.3