Skip to content

Commit

Permalink
Additional fix
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhjp01 committed May 7, 2024
1 parent 2ff7de3 commit 9801fa2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/cosim/timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,15 @@ 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<cosim::duration>(currentTime - rtStartTime_);
const auto elapsedRealTime = currentTime - rtStartTime_;

if (elapsedRealTime > sampling_period_to_monitor_.value()) {
update_rolling_average_real_time_factor(currentTime, currentSimulationTime, elapsedRealTime);
}
} 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<cosim::duration>(elapsedRealTime));
}
rtCounter_++;
}
Expand Down

0 comments on commit 9801fa2

Please sign in to comment.