A template class imlementing a stopwatch.
More...
#include <jade.stopwatch.hpp>
|
| basic_stopwatch () |
| Initializes a new instance of the class. More...
|
|
int | compare (const double seconds) const |
| Compares the elapsed time with the specified number of seconds. The method returns a negative value if the elapsed time is lesser. More...
|
|
double | get_elapsed () const |
|
std::string | str () const |
|
bool | operator< (const double rhs) const |
| Compares the elapsed time with the specified number of seconds. The operator returns a negative value if the elapsed time is lesser. More...
|
|
bool | operator> (const double rhs) const |
| Compares the elapsed time with the specified number of seconds. The operator returns a negative value if the elapsed time is greater. More...
|
|
template<typename TClock>
class jade::basic_stopwatch< TClock >
A template class imlementing a stopwatch.
Definition at line 18 of file jade.stopwatch.hpp.
◆ clock_type
template<typename TClock >
◆ time_point_type
template<typename TClock >
◆ basic_stopwatch()
template<typename TClock >
Initializes a new instance of the class.
Definition at line 30 of file jade.stopwatch.hpp.
31 : _t0 (clock_type::now())
◆ compare()
template<typename TClock >
Compares the elapsed time with the specified number of seconds. The method returns a negative value if the elapsed time is lesser.
- Returns
- Negative, positive, or zero.
- Parameters
-
seconds | The elapsed seconds to compare. |
Definition at line 41 of file jade.stopwatch.hpp.
46 const auto rhs = seconds;
47 return lhs < rhs ? -1 : rhs < lhs ? +1 : 0;
◆ get_elapsed()
template<typename TClock >
- Returns
- The elapsed time in seconds as a floating-point value.
Definition at line 53 of file jade.stopwatch.hpp.
55 const auto t1 = clock_type::now();
56 const auto dt = std::chrono::duration<double>(t1 - _t0);
◆ operator<()
template<typename TClock >
Compares the elapsed time with the specified number of seconds. The operator returns a negative value if the elapsed time is lesser.
- Returns
- True if the value is lesser; otherwise false.
- Parameters
-
rhs | The elapsed seconds to compare. |
Definition at line 76 of file jade.stopwatch.hpp.
◆ operator>()
template<typename TClock >
Compares the elapsed time with the specified number of seconds. The operator returns a negative value if the elapsed time is greater.
- Returns
- True if the value is greater; otherwise false.
- Parameters
-
rhs | The elapsed seconds to compare. |
Definition at line 89 of file jade.stopwatch.hpp.
◆ str()
template<typename TClock >
- Returns
- The current time as a string.
Definition at line 63 of file jade.stopwatch.hpp.
65 std::ostringstream out;
66 out << std::fixed << std::setprecision(6) <<
get_elapsed();
The documentation for this class was generated from the following file: