Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cyber/blocker/intra_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ auto IntraReader<MessageT>::End() const -> Iterator {

template <typename MessageT>
void IntraReader<MessageT>::OnMessage(const MessagePtr& msg_ptr) {
this->second_to_lastest_recv_time_sec_ = this->latest_recv_time_sec_;
this->second_to_latest_recv_time_sec_ = this->latest_recv_time_sec_;
this->latest_recv_time_sec_ = apollo::cyber::Time::Now().ToSecond();
if (msg_callback_ != nullptr) {
msg_callback_(msg_ptr);
Expand Down
8 changes: 4 additions & 4 deletions cyber/node/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class Reader : public ReaderBase {

protected:
double latest_recv_time_sec_ = -1.0;
double second_to_lastest_recv_time_sec_ = -1.0;
double second_to_latest_recv_time_sec_ = -1.0;
uint32_t pending_queue_size_;

private:
Expand Down Expand Up @@ -244,7 +244,7 @@ Reader<MessageT>::~Reader() {

template <typename MessageT>
void Reader<MessageT>::Enqueue(const std::shared_ptr<MessageT>& msg) {
second_to_lastest_recv_time_sec_ = latest_recv_time_sec_;
second_to_latest_recv_time_sec_ = latest_recv_time_sec_;
latest_recv_time_sec_ = Time::Now().ToSecond();
blocker_->Publish(msg);
}
Expand Down Expand Up @@ -361,11 +361,11 @@ double Reader<MessageT>::GetDelaySec() const {
if (latest_recv_time_sec_ < 0) {
return -1.0;
}
if (second_to_lastest_recv_time_sec_ < 0) {
if (second_to_latest_recv_time_sec_ < 0) {
return Time::Now().ToSecond() - latest_recv_time_sec_;
}
return std::max((Time::Now().ToSecond() - latest_recv_time_sec_),
(latest_recv_time_sec_ - second_to_lastest_recv_time_sec_));
(latest_recv_time_sec_ - second_to_latest_recv_time_sec_));
}

template <typename MessageT>
Expand Down