summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-15 11:07:45 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-02-15 11:07:45 +0100
commit1e4c0f261e00f67b0ac442a26ba581d4a1e4ed28 (patch)
treed9effd124dd5ed20459956601cd40988ff300da3 /src
parent21b9b097329453bb3c3666d9429a1d1c7257efae (diff)
downloaddabmod-1e4c0f261e00f67b0ac442a26ba581d4a1e4ed28.tar.gz
dabmod-1e4c0f261e00f67b0ac442a26ba581d4a1e4ed28.tar.bz2
dabmod-1e4c0f261e00f67b0ac442a26ba581d4a1e4ed28.zip
Add timestamp of frame 0 to statistics
Diffstat (limited to 'src')
-rw-r--r--src/TimestampDecoder.cpp27
-rw-r--r--src/TimestampDecoder.h3
2 files changed, 29 insertions, 1 deletions
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp
index b942c37..4aaaf67 100644
--- a/src/TimestampDecoder.cpp
+++ b/src/TimestampDecoder.cpp
@@ -2,7 +2,7 @@
Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the
Queen in Right of Canada (Communications Research Center Canada)
- Copyright (C) 2017
+ Copyright (C) 2018
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -46,6 +46,7 @@ TimestampDecoder::TimestampDecoder(double& offset_s) :
RC_ADD_PARAMETER(offset, "TIST offset [s]");
RC_ADD_PARAMETER(timestamp, "FCT and timestamp [s]");
+ RC_ADD_PARAMETER(timestamp0, "Timestamp of frame with FCT=0 [s]");
etiLog.level(info) << "Setting up timestamp decoder with " <<
timestamp_offset << " offset";
@@ -163,6 +164,11 @@ void TimestampDecoder::updateTimestampEti(
pushMNSCData(framephase, mnsc);
latestFCT = fct;
latestFP = framephase;
+
+ if (full_timestamp_received and fct == 0) {
+ time_secs_of_frame0 = time_secs;
+ time_pps_of_frame0 = time_pps;
+ }
}
void TimestampDecoder::updateTimestampEdi(
@@ -176,6 +182,11 @@ void TimestampDecoder::updateTimestampEdi(
latestFCT = fct;
latestFP = framephase;
full_timestamp_received = true;
+
+ if (fct == 0) {
+ time_secs_of_frame0 = time_secs;
+ time_pps_of_frame0 = time_pps;
+ }
}
void TimestampDecoder::set_parameter(
@@ -194,6 +205,9 @@ void TimestampDecoder::set_parameter(
else if (parameter == "timestamp") {
throw ParameterError("timestamp is read-only");
}
+ else if (parameter == "timestamp0") {
+ throw ParameterError("timestamp0 is read-only");
+ }
else {
stringstream ss_err;
ss_err << "Parameter '" << parameter
@@ -221,6 +235,17 @@ const std::string TimestampDecoder::get_parameter(
throw ParameterError("Not available yet");
}
}
+ else if (parameter == "timestamp0") {
+ if (full_timestamp_received) {
+ ss.setf(std::ios_base::fixed, std::ios_base::floatfield);
+ ss << time_secs_of_frame0 +
+ ((double)time_pps_of_frame0 / 16384000.0) <<
+ " for frame FCT 0";
+ }
+ else {
+ throw ParameterError("Not available yet");
+ }
+ }
else {
ss << "Parameter '" << parameter <<
"' is not exported by controllable " << get_rc_name();
diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h
index 0411f1a..31c8bec 100644
--- a/src/TimestampDecoder.h
+++ b/src/TimestampDecoder.h
@@ -165,6 +165,9 @@ class TimestampDecoder : public RemoteControllable
int inhibit_second_update = 0;
bool offset_changed = false;
+ uint32_t time_secs_of_frame0 = 0;
+ uint32_t time_pps_of_frame0 = 0;
+
/* When the type or identifier don't match, the decoder must
* be disabled
*/