diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-23 10:32:57 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2019-01-23 10:32:57 +0100 |
commit | 9fec888d1e5e68600b854408324eef059bbc2b47 (patch) | |
tree | 62656f12b8c63558ace53a20c239452068a12209 /src/TimestampDecoder.h | |
parent | e352ec38c20d626a4359c684abea23ef92a41470 (diff) | |
download | dabmod-9fec888d1e5e68600b854408324eef059bbc2b47.tar.gz dabmod-9fec888d1e5e68600b854408324eef059bbc2b47.tar.bz2 dabmod-9fec888d1e5e68600b854408324eef059bbc2b47.zip |
TimestampDecoder: handle negative offset properly
Diffstat (limited to 'src/TimestampDecoder.h')
-rw-r--r-- | src/TimestampDecoder.h | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/TimestampDecoder.h b/src/TimestampDecoder.h index ed41dfb..d083061 100644 --- a/src/TimestampDecoder.h +++ b/src/TimestampDecoder.h @@ -44,22 +44,9 @@ struct frame_timestamp bool timestamp_valid = false; bool timestamp_refresh; - frame_timestamp& operator+=(const double& diff) - { - double offset_pps, offset_secs; - offset_pps = modf(diff, &offset_secs); - - this->timestamp_sec += lrint(offset_secs); - this->timestamp_pps += lrint(offset_pps * 16384000.0); - - while (this->timestamp_pps >= 16384000) { - this->timestamp_pps -= 16384000; - this->timestamp_sec += 1; - } - return *this; - } + frame_timestamp& operator+=(const double& diff); - const frame_timestamp operator+(const double diff) { + const frame_timestamp operator+(const double diff) const { frame_timestamp ts = *this; ts += diff; return ts; |