mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-02 21:53:51 +00:00
Changed to steady clock for timer
This commit is contained in:
parent
29e0b5c0f0
commit
32b2e158a5
@ -13,7 +13,7 @@ namespace CLI {
|
|||||||
class Timer {
|
class Timer {
|
||||||
protected:
|
protected:
|
||||||
/// This is a typedef to make clocks easier to use
|
/// This is a typedef to make clocks easier to use
|
||||||
typedef std::chrono::high_resolution_clock clock;
|
typedef std::chrono::steady_clock clock;
|
||||||
|
|
||||||
/// This typedef is for points in time
|
/// This typedef is for points in time
|
||||||
typedef std::chrono::time_point<clock> time_point;
|
typedef std::chrono::time_point<clock> time_point;
|
||||||
@ -69,8 +69,8 @@ public:
|
|||||||
start_ = start;
|
start_ = start;
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
/// This formats the numerical value for the time string
|
|
||||||
|
|
||||||
|
/// This formats the numerical value for the time string
|
||||||
std::string make_time_str() const {
|
std::string make_time_str() const {
|
||||||
time_point stop = clock::now();
|
time_point stop = clock::now();
|
||||||
std::chrono::duration<double> elapsed = stop - start_;
|
std::chrono::duration<double> elapsed = stop - start_;
|
||||||
@ -102,7 +102,7 @@ public:
|
|||||||
return time_print_(title_, make_time_str());
|
return time_print_(title_, make_time_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Division sets the number of cycles
|
/// Division sets the number of cycles to divide by (no graphical change)
|
||||||
Timer& operator / (size_t val) {cycles = val; return *this;}
|
Timer& operator / (size_t val) {cycles = val; return *this;}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user