diff --git a/src/cosim/timer.cpp b/src/cosim/timer.cpp index 99026229..101407aa 100644 --- a/src/cosim/timer.cpp +++ b/src/cosim/timer.cpp @@ -104,8 +104,7 @@ class real_time_timer::impl metrics_->total_average_real_time_factor = relativeSimTime.count() / (1.0 * relativeRealTime.count()); if (sampling_period_to_monitor_.has_value()) { - const auto elapsedRealTime = - tick_period_match_ ? currentTime - rtStartTime_ : std::chrono::duration_cast(currentTime - rtStartTime_); + const auto elapsedRealTime = currentTime - rtStartTime_; if (elapsedRealTime > sampling_period_to_monitor_.value()) { update_rolling_average_real_time_factor(currentTime, currentSimulationTime, elapsedRealTime); @@ -113,7 +112,7 @@ class real_time_timer::impl } else if (rtCounter_ >= config_->steps_to_monitor.load()) { const auto elapsedRealTime = currentTime - rtStartTime_; - update_rolling_average_real_time_factor(currentTime, currentSimulationTime, elapsedRealTime); + update_rolling_average_real_time_factor(currentTime, currentSimulationTime, std::chrono::duration_cast(elapsedRealTime)); } rtCounter_++; }