diff --git a/include/CLI/Timer.hpp b/include/CLI/Timer.hpp index edb7eaa..9c8b8f0 100644 --- a/include/CLI/Timer.hpp +++ b/include/CLI/Timer.hpp @@ -74,7 +74,7 @@ public: std::string make_time_str() const { time_point stop = clock::now(); std::chrono::duration elapsed = stop - start_; - double time = elapsed.count(); + double time = elapsed.count() / cycles; return make_time_str(time); } diff --git a/tests/TimerTest.cpp b/tests/TimerTest.cpp index 529ce09..c9a357b 100644 --- a/tests/TimerTest.cpp +++ b/tests/TimerTest.cpp @@ -12,7 +12,7 @@ TEST(Timer, MSTimes) { CLI::Timer timer{"My Timer"}; std::this_thread::sleep_for(std::chrono::milliseconds(123)); std::string output = timer.to_string(); - std::new_output = (timer / 1000000).to_string(); + std::string new_output = (timer / 1000000).to_string(); EXPECT_THAT(output, HasSubstr("My Timer")); EXPECT_THAT(output, HasSubstr(" ms")); EXPECT_THAT(new_output, HasSubstr(" ns"));