aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-09-12 17:13:26 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-09-12 17:13:26 +0200
commit4f9372c130960559a0bba13828a810eb57e30123 (patch)
tree45daacdb4074387eca4d1993173d8c553cebde1c /src
parent0efe514cc7b788e6009df4b520c076c9931939fb (diff)
parent3b1faf9c91d1fd7d1bb26b744bf0a84c631806f0 (diff)
downloaddabmod-4f9372c130960559a0bba13828a810eb57e30123.tar.gz
dabmod-4f9372c130960559a0bba13828a810eb57e30123.tar.bz2
dabmod-4f9372c130960559a0bba13828a810eb57e30123.zip
Merge 'next' into next_memless
Diffstat (limited to 'src')
-rw-r--r--src/TimestampDecoder.cpp11
-rw-r--r--src/TimestampDecoder.h24
2 files changed, 22 insertions, 13 deletions
diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp
index ba1a221..ddd3fb7 100644
--- a/src/TimestampDecoder.cpp
+++ b/src/TimestampDecoder.cpp
@@ -38,10 +38,10 @@
#define MDEBUG(fmt, args...) PDEBUG(fmt, ## args)
-void TimestampDecoder::calculateTimestamp(struct frame_timestamp& ts)
+void TimestampDecoder::calculateTimestamp(frame_timestamp& ts)
{
- std::shared_ptr<struct frame_timestamp> ts_queued =
- std::make_shared<struct frame_timestamp>();
+ std::shared_ptr<frame_timestamp> ts_queued =
+ std::make_shared<frame_timestamp>();
/* Push new timestamp into queue */
ts_queued->timestamp_valid = full_timestamp_received;
@@ -115,7 +115,10 @@ void TimestampDecoder::pushMNSCData(int framephase, uint16_t mnsc)
mnsc0 = (struct eti_MNSC_TIME_0*)&mnsc;
enableDecode = (mnsc0->type == 0) &&
(mnsc0->identifier == 0);
- gmtime_r(0, &temp_time);
+ {
+ const time_t timep = 0;
+ gmtime_r(&timep, &temp_time);
+ }
break;
case 1:
diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h
index c835430..e0dee2a 100644
--- a/src/TimestampDecoder.h
+++ b/src/TimestampDecoder.h
@@ -46,7 +46,9 @@ struct frame_timestamp
bool timestamp_valid;
bool timestamp_refresh;
- struct frame_timestamp operator=(const struct frame_timestamp &rhs)
+ frame_timestamp() = default;
+ frame_timestamp(const frame_timestamp& other) = default;
+ frame_timestamp operator=(const frame_timestamp &rhs)
{
if (this != &rhs) {
this->timestamp_sec = rhs.timestamp_sec;
@@ -59,7 +61,7 @@ struct frame_timestamp
return *this;
}
- struct frame_timestamp& operator+=(const double& diff)
+ frame_timestamp& operator+=(const double& diff)
{
double offset_pps, offset_secs;
offset_pps = modf(diff, &offset_secs);
@@ -75,9 +77,9 @@ struct frame_timestamp
return *this;
}
- const struct frame_timestamp operator+(const double diff)
+ const frame_timestamp operator+(const double diff)
{
- struct frame_timestamp ts = *this;
+ frame_timestamp ts = *this;
ts += diff;
return ts;
}
@@ -89,7 +91,7 @@ struct frame_timestamp
void print(const char* t)
{
fprintf(stderr,
- "%s <struct frame_timestamp(%s, %d, %.9f, %d)>\n",
+ "%s <frame_timestamp(%s, %d, %.9f, %d)>\n",
t, this->timestamp_valid ? "valid" : "invalid",
this->timestamp_sec, pps_offset(),
this->fct);
@@ -122,8 +124,12 @@ class TimestampDecoder : public RemoteControllable
latestFCT = 0;
enableDecode = false;
full_timestamp_received = false;
- bzero(&temp_time, sizeof(temp_time));
- gmtime_r(0, &temp_time);
+
+ // Properly initialise temp_time
+ memset(&temp_time, 0, sizeof(temp_time));
+ const time_t timep = 0;
+ gmtime_r(&timep, &temp_time);
+
offset_changed = false;
RC_ADD_PARAMETER(offset, "TIST offset [s]");
@@ -135,7 +141,7 @@ class TimestampDecoder : public RemoteControllable
};
/* Calculate the timestamp for the current frame. */
- void calculateTimestamp(struct frame_timestamp& ts);
+ void calculateTimestamp(frame_timestamp& ts);
/* Update timestamp data from ETI */
void updateTimestampEti(
@@ -206,7 +212,7 @@ class TimestampDecoder : public RemoteControllable
* synchronise two modulators if only one uses (for instance) the
* FIRFilter (1 stage pipeline)
*/
- std::queue<std::shared_ptr<struct frame_timestamp> > queue_timestamps;
+ std::queue<std::shared_ptr<frame_timestamp> > queue_timestamps;
};