Class Duration
Defined in File Duration.hpp
Class Documentation
-
class Duration
Duration represents a time interval and -
Can be incremented by durations expressed as seconds, nanoseconds milliseconds, or Duration objects.
Can be converted to and from Durations expressed in milliseconds (or other units) as integer types.
Public Functions
-
explicit Duration(int32_t sec, uint32_t nanosec = 0)
Create a Duration elapsing a specific amount of time.
-
int compare(const Duration &that) const
Returns an integer value for a comparison of two Durations: 1 if this Duration is greater than the comparator (that) -1 if the Duration is less than the comparator (that) 0 if the Duration matches the comparator (that)
- Parameters
that – Duration to compare
- Returns
comparison result
-
bool operator>(const Duration &that) const
Returns true if the Duration is greater than the comparator
- Parameters
that – Duration to compare
- Returns
comparison result
-
bool operator>=(const Duration &that) const
Returns true if the Duration is greater than or equal to the comparator
- Parameters
Duration – &that
-
bool operator!=(const Duration &that) const
Returns true if the Duration is not equal to the comparator
- Parameters
that – Duration to compare
- Returns
comparison result
-
bool operator==(const Duration &that) const
Returns true if the Duration is equal to the comparator
- Parameters
that – Duration to compare
- Returns
comparison result
-
bool operator<=(const Duration &that) const
Returns true if the Duration is less than or equal to the comparator
- Parameters
that – Duration to compare
- Returns
comparison result
-
bool operator<(const Duration &that) const
Returns true if the Duration is less than the comparator
- Parameters
that – Duration to compare
- Returns
comparison result
-
int64_t to_millisecs() const
Returns this Duration in milliseconds.
- Returns
the duration in milliseconds
Public Static Functions
-
static const Duration from_microsecs(int64_t microseconds)
Create a Duration from a number of microseconds
- Parameters
microseconds – number of microseconds