aboutsummaryrefslogtreecommitdiffstats
path: root/src/EtiReader.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-20 12:13:43 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-01-20 12:13:43 +0100
commitceb14883102e52daff611077adfe1b63837c3a76 (patch)
tree0a37d9d08065406fb83e401e68badb6a9b367edd /src/EtiReader.cpp
parent01c0f656cafd657abc4c9d538101cf1170619951 (diff)
downloaddabmod-ceb14883102e52daff611077adfe1b63837c3a76.tar.gz
dabmod-ceb14883102e52daff611077adfe1b63837c3a76.tar.bz2
dabmod-ceb14883102e52daff611077adfe1b63837c3a76.zip
EDI input: decode timestamps
Diffstat (limited to 'src/EtiReader.cpp')
-rw-r--r--src/EtiReader.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/EtiReader.cpp b/src/EtiReader.cpp
index de23142..0b27126 100644
--- a/src/EtiReader.cpp
+++ b/src/EtiReader.cpp
@@ -291,6 +291,11 @@ bool EtiReader::sourceContainsTimestamp()
/* See ETS 300 799, Annex C.2.2 */
}
+void EtiReader::calculateTimestamp(struct frame_timestamp& ts)
+{
+ myTimestampDecoder.calculateTimestamp(ts);
+}
+
uint32_t EtiReader::getPPSOffset()
{
if (!sourceContainsTimestamp()) {
@@ -357,6 +362,7 @@ bool EdiReader::sourceContainsTimestamp()
void EdiReader::calculateTimestamp(struct frame_timestamp& ts)
{
+ m_timestamp_decoder.calculateTimestamp(ts);
}
bool EdiReader::isFrameReady()
@@ -521,8 +527,12 @@ void EdiReader::assemble()
/* According to Annex F
* EDI = UTC + UTCO
* We need UTC = EDI - UTCO
+ *
+ * The seconds value is given in number of seconds since
+ * 1.1.2000
*/
- auto utc_ts = m_seconds - m_utco;
+ const std::time_t posix_timestamp_1_jan_2000 = 946684800;
+ auto utc_ts = posix_timestamp_1_jan_2000 + m_seconds - m_utco;
m_timestamp_decoder.updateTimestampEdi(
utc_ts, m_fc.tsta, m_fc.fct());