From a4eb611dc1e8ba19e81930de34107a37761fecc8 Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Mon, 23 Sep 2024 16:43:31 +0200 Subject: [PATCH] Refs #21314: Fix conflicts and build issues Signed-off-by: JesusPoderoso --- .../fastdds/domain/DomainParticipantImpl.cpp | 2 +- src/cpp/fastdds/publisher/DataWriterImpl.cpp | 11 ++++++----- src/cpp/fastdds/subscriber/DataReaderImpl.cpp | 18 ++++++++++-------- src/cpp/rtps/writer/StatefulWriter.cpp | 4 ++-- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp index fcd37f31d55..eb47373fa09 100644 --- a/src/cpp/fastdds/domain/DomainParticipantImpl.cpp +++ b/src/cpp/fastdds/domain/DomainParticipantImpl.cpp @@ -1221,7 +1221,7 @@ bool DomainParticipantImpl::contains_entity( ReturnCode_t DomainParticipantImpl::get_current_time( fastrtps::Time_t& current_time) const { - fastdds::dds::Time_t::now(current_time); + fastrtps::Time_t::now(current_time); return ReturnCode_t::RETCODE_OK; } diff --git a/src/cpp/fastdds/publisher/DataWriterImpl.cpp b/src/cpp/fastdds/publisher/DataWriterImpl.cpp index 97c78bd824c..9eecbdf7589 100644 --- a/src/cpp/fastdds/publisher/DataWriterImpl.cpp +++ b/src/cpp/fastdds/publisher/DataWriterImpl.cpp @@ -1550,24 +1550,25 @@ bool DataWriterImpl::lifespan_expired() { std::unique_lock lock(writer_->getMutex()); - fastdds::rtps::Time_t current_ts; - fastdds::rtps::Time_t::now(current_ts); + fastrtps::Time_t current_ts; + fastrtps::Time_t::now(current_ts); CacheChange_t* earliest_change; while (history_.get_earliest_change(&earliest_change)) { - fastdds::rtps::Time_t expiration_ts = earliest_change->sourceTimestamp + qos_.lifespan().duration; + fastrtps::Time_t expiration_ts(earliest_change->sourceTimestamp.seconds(), earliest_change->sourceTimestamp.nanosec()); + expiration_ts = expiration_ts + qos_.lifespan().duration; // Check that the earliest change has expired (the change which started the timer could have been removed from the history) if (current_ts < expiration_ts) { - fastdds::rtps::Time_t interval = expiration_ts - current_ts; + fastrtps::Time_t interval = expiration_ts - current_ts; lifespan_timer_->update_interval_millisec(interval.to_ns() * 1e-6); return true; } // The earliest change has expired - history_->remove_change_pub(earliest_change); + history_.remove_change_pub(earliest_change); } return false; diff --git a/src/cpp/fastdds/subscriber/DataReaderImpl.cpp b/src/cpp/fastdds/subscriber/DataReaderImpl.cpp index 325150752e9..822ae4caf76 100644 --- a/src/cpp/fastdds/subscriber/DataReaderImpl.cpp +++ b/src/cpp/fastdds/subscriber/DataReaderImpl.cpp @@ -1123,9 +1123,10 @@ bool DataReaderImpl::on_new_cache_change_added( return true; } - fastdds::rtps::Time_t expiration_ts = change->sourceTimestamp + qos_.lifespan().duration; - fastdds::rtps::Time_t current_ts; - fastdds::rtps::Time_t::now(current_ts); + fastrtps::Time_t expiration_ts(change->sourceTimestamp.seconds(), change->sourceTimestamp.nanosec()); + expiration_ts = expiration_ts + qos_.lifespan().duration; + fastrtps::Time_t current_ts; + fastrtps::Time_t::now(current_ts); // The new change could have expired if it arrived too late // If so, remove it from the history and return false to avoid notifying the listener @@ -1153,7 +1154,7 @@ bool DataReaderImpl::on_new_cache_change_added( // Update and restart the timer // If the timer is already running this will not have any effect - fastdds::rtps::Time_t interval = expiration_ts - current_ts; + fastrtps::Time_t interval = expiration_ts - current_ts; lifespan_timer_->update_interval_millisec(interval.to_ns() * 1e-6); lifespan_timer_->restart_timer(); return true; @@ -1273,18 +1274,19 @@ bool DataReaderImpl::lifespan_expired() { std::unique_lock lock(reader_->getMutex()); - fastdds::rtps::Time_t current_ts; - fastdds::rtps::Time_t::now(current_ts); + fastrtps::Time_t current_ts; + fastrtps::Time_t::now(current_ts); CacheChange_t* earliest_change; while (history_.get_earliest_change(&earliest_change)) { - fastdds::rtps::Time_t expiration_ts = earliest_change->sourceTimestamp + qos_.lifespan().duration; + fastrtps::Time_t expiration_ts(earliest_change->sourceTimestamp.seconds(), earliest_change->sourceTimestamp.nanosec()); + expiration_ts = expiration_ts + qos_.lifespan().duration; // Check that the earliest change has expired (the change which started the timer could have been removed from the history) if (current_ts < expiration_ts) { - fastdds::rtps::Time_t interval = expiration_ts - current_ts; + fastrtps::Time_t interval = expiration_ts - current_ts; lifespan_timer_->update_interval_millisec(interval.to_ns() * 1e-6); return true; } diff --git a/src/cpp/rtps/writer/StatefulWriter.cpp b/src/cpp/rtps/writer/StatefulWriter.cpp index c72cf1e3ff3..d036152f024 100644 --- a/src/cpp/rtps/writer/StatefulWriter.cpp +++ b/src/cpp/rtps/writer/StatefulWriter.cpp @@ -182,7 +182,7 @@ StatefulWriter::StatefulWriter( , may_remove_change_(0) , disable_heartbeat_piggyback_(att.disable_heartbeat_piggyback) , disable_positive_acks_(att.disable_positive_acks) - , keep_duration_us_(att.keep_duration.to_ns() * 1e-3) + , keep_duration_(att.keep_duration.to_ns() * 1e-3) , last_sequence_number_() , biggest_removed_sequence_number_() , sendBufferSize_(pimpl->get_min_network_send_buffer_size()) @@ -217,7 +217,7 @@ StatefulWriter::StatefulWriter( , may_remove_change_(0) , disable_heartbeat_piggyback_(att.disable_heartbeat_piggyback) , disable_positive_acks_(att.disable_positive_acks) - , keep_duration_us_(att.keep_duration.to_ns() * 1e-3) + , keep_duration_(att.keep_duration.to_ns() * 1e-3) , last_sequence_number_() , biggest_removed_sequence_number_() , sendBufferSize_(pimpl->get_min_network_send_buffer_size())