From c04519899148652772f41fdb70e0151df5394924 Mon Sep 17 00:00:00 2001 From: TinyO Date: Tue, 22 Oct 2019 11:15:47 +0800 Subject: [PATCH] fix(*): ubuntu 18.04 complie. --- src/mynteye/device/channel/channels.cc | 8 +++++++- src/mynteye/device/streams.cc | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/mynteye/device/channel/channels.cc b/src/mynteye/device/channel/channels.cc index 783e78e..127cb10 100644 --- a/src/mynteye/device/channel/channels.cc +++ b/src/mynteye/device/channel/channels.cc @@ -533,7 +533,13 @@ void Channels::CheckTimeStampLimmit(mynteye::ImuPacket2 &packet) { } if (is_nearly_before_timestamp_limmit_ > 0) { is_nearly_before_timestamp_limmit_--; - if (std::abs(current_datum_ - segment2.timestamp) > (uint64_t)(42949672960/2)) { // NOLINT + uint64_t abs_tmp = 0; + if (current_datum_ > segment2.timestamp) { + abs_tmp = current_datum_ - segment2.timestamp; + } else { + abs_tmp = segment2.timestamp - current_datum_; + } + if (abs_tmp > (uint64_t)(42949672960/2)) { // NOLINT segment2.timestamp -= 42949672960; } } diff --git a/src/mynteye/device/streams.cc b/src/mynteye/device/streams.cc index 99484e4..a4e35df 100644 --- a/src/mynteye/device/streams.cc +++ b/src/mynteye/device/streams.cc @@ -59,7 +59,13 @@ void Streams::CheckTimeStampLimmit(std::shared_ptr img) { } if (is_nearly_before_timestamp_limmit_ > 0) { is_nearly_before_timestamp_limmit_--; - if (std::abs(current_datum_ - img->timestamp) > (uint64_t)(42949672960/2)) { // NOLINT + uint64_t abs_tmp = 0; + if (current_datum_ > img->timestamp) { + abs_tmp = current_datum_ - img->timestamp; + } else { + abs_tmp = img->timestamp - current_datum_; + } + if (abs_tmp > (uint64_t)(42949672960/2)) { // NOLINT img->timestamp -= 42949672960; } }