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:
parent
416e6a0443
commit
29e0b5c0f0
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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"));
|
||||
|
Loading…
x
Reference in New Issue
Block a user