Skip to content

Commit

Permalink
Merge pull request #1132 from ApexAI/iox-#1130-replace-high-resolutio…
Browse files Browse the repository at this point in the history
…n-clock-with-system-clock-and-steady-clock

Iox #1130 replace high resolution clock with system clock and steady clock
  • Loading branch information
elBoberido authored Feb 18, 2022
2 parents d686972 + 7972c69 commit 0191b3c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/website/release-notes/iceoryx-v2-0-0.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
- When posix mutex fails a correct error message is reported on the console [\#999](https://github.com/eclipse-iceoryx/iceoryx/issues/999)
- Only use `std::result_of` for C++14 to be able to use iceoryx in C++20 projects [\#1076](https://github.com/eclipse-iceoryx/iceoryx/issues/1076)
- Set stack size for windows in `singleprocess` example and posh tests [\#1082](https://github.com/eclipse-iceoryx/iceoryx/issues/1082)
- Roudi console timestamps is out of date [#1130](https://github.com/eclipse-iceoryx/iceoryx/issues/1130)

**Refactoring:**

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_examples/iceperf/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ void IcePerfBase::releaseFollower() noexcept

iox::units::Duration IcePerfBase::latencyPerfTestLeader(const uint64_t numRoundTrips) noexcept
{
auto start = std::chrono::high_resolution_clock::now();
auto start = std::chrono::steady_clock::now();

// run the performance test
for (auto i = 0U; i < numRoundTrips; ++i)
Expand All @@ -44,7 +44,7 @@ iox::units::Duration IcePerfBase::latencyPerfTestLeader(const uint64_t numRoundT
sendPerfTopic(perfTopic.payloadSize, RunFlag::RUN);
}

auto finish = std::chrono::high_resolution_clock::now();
auto finish = std::chrono::steady_clock::now();

constexpr uint64_t TRANSMISSIONS_PER_ROUNDTRIP{2U};
auto duration = std::chrono::duration_cast<std::chrono::nanoseconds>(finish - start);
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_hoofs/source/log/logstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ LogStream::LogStream(Logger& logger, LogLevel logLevel) noexcept
{
m_logEntry.level = logLevel;
/// @todo do we want to do this only when loglevel is higher than global loglevel?
auto timePoint = std::chrono::high_resolution_clock::now();
auto timePoint = std::chrono::system_clock::now();
m_logEntry.time = std::chrono::duration_cast<std::chrono::milliseconds>(timePoint.time_since_epoch());
}

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/source/runtime/ipc_runtime_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ IpcRuntimeInterface::IpcRuntimeInterface(const RuntimeName_t& roudiName,
{
using namespace units;
using namespace std::chrono;
auto timestamp = duration_cast<microseconds>(high_resolution_clock::now().time_since_epoch()).count();
auto timestamp = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
while (transmissionTimestamp == timestamp)
{
timestamp = duration_cast<microseconds>(high_resolution_clock::now().time_since_epoch()).count();
timestamp = duration_cast<microseconds>(system_clock::now().time_since_epoch()).count();
}
transmissionTimestamp = timestamp;

Expand Down

0 comments on commit 0191b3c

Please sign in to comment.