1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-07 23:33:52 +00:00

Support for division for timers

This commit is contained in:
Henry Fredrick Schreiner 2017-05-15 11:26:41 -04:00
parent 416e6a0443
commit 29e0b5c0f0
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ public:
std::string make_time_str() const {
time_point stop = clock::now();
std::chrono::duration<double> elapsed = stop - start_;
double time = elapsed.count();
double time = elapsed.count() / cycles;
return make_time_str(time);
}

View File

@ -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"));