From 97458a2e08d5bf4904553eb76467fb047e4719f4 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 10 Feb 2021 12:04:23 +0100 Subject: Add timestamp offset to management server for EDI input --- src/input/Edi.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/input') diff --git a/src/input/Edi.cpp b/src/input/Edi.cpp index e6a7e3e..2aa776f 100644 --- a/src/input/Edi.cpp +++ b/src/input/Edi.cpp @@ -117,6 +117,7 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size) { // Save stats data in bytes, not in frames m_stats.notifyBuffer(m_frames.size() * size); + m_stats.notifyTimestampOffset(0); EdiDecoder::sti_frame_t sti; if (m_is_prebuffering) { @@ -221,6 +222,7 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc auto ts_req = EdiDecoder::frame_timestamp_t::from_unix_epoch(seconds, utco, tsta); ts_req += m_tist_delay; const double offset = ts_req.diff_s(m_pending_sti_frame.timestamp); + m_stats.notifyTimestampOffset(offset); if (offset < 0) { // Too far in the future @@ -265,12 +267,12 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc if (num_discarded_wrong_size > 0) { etiLog.level(warn) << "EDI input " << m_name << ": " << - num_discarded_wrong_size << "packets with wrong size."; + num_discarded_wrong_size << " packets with wrong size."; } if (num_discarded_invalid_ts > 0) { etiLog.level(warn) << "EDI input " << m_name << ": " << - num_discarded_wrong_size << "packets with invalid timestamp."; + num_discarded_wrong_size << " packets with invalid timestamp."; } memset(buffer, 0, size); @@ -298,6 +300,7 @@ size_t Edi::readFrame(uint8_t *buffer, size_t size, std::time_t seconds, int utc auto ts_req = EdiDecoder::frame_timestamp_t::from_unix_epoch(seconds, utco, tsta); ts_req += m_tist_delay; const double offset = m_pending_sti_frame.timestamp.diff_s(ts_req); + m_stats.notifyTimestampOffset(offset); if (-24e-3 < offset and offset <= 0) { if (not m_pending_sti_frame.version_data.version.empty()) { -- cgit v1.2.3