Skip to content

Commit

Permalink
send frequency calculation fixed in case of unconnected publisher (#1608
Browse files Browse the repository at this point in the history
)
  • Loading branch information
rex-schilasky authored May 22, 2024
1 parent 7eeba20 commit d6563f4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ecal/core/src/readwrite/ecal_writer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* ========================= eCAL LICENSE =================================
*
* Copyright (C) 2016 - 2019 Continental Corporation
* Copyright (C) 2016 - 2024 Continental Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -406,13 +406,6 @@ namespace eCAL

size_t CDataWriter::Write(CPayloadWriter& payload_, long long time_, long long id_)
{
{
// we should think about if we would like to potentially use the `time_` variable to tick with (but we would need the same base for checking incoming samples then....
const auto send_time = std::chrono::steady_clock::now();
const std::lock_guard<std::mutex> lock(m_frequency_calculator_mutex);
m_frequency_calculator.addTick(send_time);
}

// check writer modes
if (!CheckWriterModes())
{
Expand Down Expand Up @@ -769,6 +762,14 @@ namespace eCAL

// statistics
g_process_wclock++;

// update send frequency
{
// we should think about if we would like to potentially use the `time_` variable to tick with (but we would need the same base for checking incoming samples then....
const auto send_time = std::chrono::steady_clock::now();
const std::lock_guard<std::mutex> lock(m_frequency_calculator_mutex);
m_frequency_calculator.addTick(send_time);
}
}

std::string CDataWriter::Dump(const std::string& indent_ /* = "" */)
Expand Down

0 comments on commit d6563f4

Please sign in to comment.