Skip to content

Commit

Permalink
SHM: Replaced eCAL::Time (-> non-steady clock) for loop-time computat…
Browse files Browse the repository at this point in the history
…ion in memfile pool with std::steady_clock (#727)
  • Loading branch information
FlorianReimold authored Jul 28, 2022
1 parent ee29fe7 commit 534bc59
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ecal/core/src/io/ecal_memfile_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

#include "ecal_memfile_pool.h"

#include <chrono>

namespace eCAL
{
////////////////////////////////////////
Expand Down Expand Up @@ -157,7 +159,7 @@ namespace eCAL
while((m_timeout_read < timeout_) && !m_do_stop)
{
// loop start in ms
auto loop_start = eCAL::Time::GetMicroSeconds()/1000;
auto loop_start = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();

// check for memory file update event from shm writer (20 ms)
if(gWaitForEvent(m_event_snd, 20))
Expand Down Expand Up @@ -254,7 +256,7 @@ namespace eCAL
else
{
// increase timeout in ms
m_timeout_read += eCAL::Time::GetMicroSeconds()/1000 - loop_start;
m_timeout_read += std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count() - loop_start;
}
}

Expand Down

0 comments on commit 534bc59

Please sign in to comment.