Strongly-typed time span with cached conversions between ns/ms/s.
More...
#include <spk_duration.hpp>
|
|
| Duration () |
| | Constructs a zero duration (milliseconds by default).
|
| | Duration (long double p_value, TimeUnit p_unit) |
| | Constructs a duration with value and unit.
|
| | Duration (const Duration &p_other) |
| | Copies duration value and unit from another instance.
|
| | Duration (Duration &&p_other) noexcept |
| | Moves duration value and cached data from another instance.
|
| Duration & | operator= (const Duration &p_other) |
| | Copies duration value and unit from another instance.
|
| Duration & | operator= (Duration &&p_other) noexcept |
| | Moves duration value and cache ownership from another instance.
|
| long long | nanoseconds () const |
| | Returns the duration in nanoseconds.
|
| long long | milliseconds () const |
| | Returns the duration in milliseconds.
|
| double | seconds () const |
| | Returns the duration in seconds.
|
| Duration | operator- () const |
| | Unary minus producing the symmetric duration.
|
| Duration | operator+ (const Duration &p_o) const |
| | Adds two durations.
|
| Duration | operator- (const Duration &p_o) const |
| | Subtracts another duration.
|
| Duration & | operator+= (const Duration &p_o) |
| | Adds another duration to this instance.
|
| Duration & | operator-= (const Duration &p_o) |
| | Subtracts another duration from this instance.
|
| bool | operator== (const Duration &p_o) const |
| | Equality comparison using canonical nanoseconds.
|
| bool | operator!= (const Duration &p_o) const |
| | Inequality comparison using canonical nanoseconds.
|
| bool | operator< (const Duration &p_o) const |
| | Strictly-less comparison using canonical nanoseconds.
|
| bool | operator> (const Duration &p_o) const |
| | Strictly-greater comparison using canonical nanoseconds.
|
| bool | operator<= (const Duration &p_o) const |
| | Less-or-equal comparison using canonical nanoseconds.
|
| bool | operator>= (const Duration &p_o) const |
| | Greater-or-equal comparison using canonical nanoseconds.
|
Strongly-typed time span with cached conversions between ns/ms/s.
◆ Duration() [1/3]
| spk::Duration::Duration |
( |
long double | p_value, |
|
|
TimeUnit | p_unit ) |
Constructs a duration with value and unit.
- Parameters
-
| p_value | Numeric value. |
| p_unit | Unit (ns, ms, s). |
◆ Duration() [2/3]
| spk::Duration::Duration |
( |
const Duration & | p_other | ) |
|
Copies duration value and unit from another instance.
- Parameters
-
◆ Duration() [3/3]
| spk::Duration::Duration |
( |
Duration && | p_other | ) |
|
|
noexcept |
Moves duration value and cached data from another instance.
- Parameters
-
◆ milliseconds()
| long long spk::Duration::milliseconds |
( |
| ) |
const |
Returns the duration in milliseconds.
- Returns
- Duration value expressed in milliseconds.
◆ nanoseconds()
| long long spk::Duration::nanoseconds |
( |
| ) |
const |
Returns the duration in nanoseconds.
- Returns
- Duration value expressed in nanoseconds.
◆ operator!=()
| bool spk::Duration::operator!= |
( |
const Duration & | p_o | ) |
const |
Inequality comparison using canonical nanoseconds.
- Parameters
-
| p_o | Other duration to compare. |
- Returns
- true when durations differ.
◆ operator+()
Adds two durations.
- Parameters
-
| p_o | Other duration to add. |
- Returns
- Sum of durations.
◆ operator+=()
Adds another duration to this instance.
- Parameters
-
| p_o | Other duration to add. |
- Returns
- Reference to this duration.
◆ operator-() [1/2]
| Duration spk::Duration::operator- |
( |
| ) |
const |
Unary minus producing the symmetric duration.
- Returns
- Negated duration.
◆ operator-() [2/2]
Subtracts another duration.
- Parameters
-
| p_o | Other duration to subtract. |
- Returns
- Difference of durations.
◆ operator-=()
Subtracts another duration from this instance.
- Parameters
-
| p_o | Other duration to subtract. |
- Returns
- Reference to this duration.
◆ operator<()
| bool spk::Duration::operator< |
( |
const Duration & | p_o | ) |
const |
Strictly-less comparison using canonical nanoseconds.
- Parameters
-
| p_o | Other duration to compare. |
- Returns
- true when this duration is shorter.
◆ operator<=()
| bool spk::Duration::operator<= |
( |
const Duration & | p_o | ) |
const |
Less-or-equal comparison using canonical nanoseconds.
- Parameters
-
| p_o | Other duration to compare. |
- Returns
- true when this duration is shorter or equal.
◆ operator=() [1/2]
Copies duration value and unit from another instance.
- Parameters
-
- Returns
- Reference to this duration.
◆ operator=() [2/2]
Moves duration value and cache ownership from another instance.
- Parameters
-
- Returns
- Reference to this duration.
◆ operator==()
| bool spk::Duration::operator== |
( |
const Duration & | p_o | ) |
const |
Equality comparison using canonical nanoseconds.
- Parameters
-
| p_o | Other duration to compare. |
- Returns
- true when durations are equal.
◆ operator>()
| bool spk::Duration::operator> |
( |
const Duration & | p_o | ) |
const |
Strictly-greater comparison using canonical nanoseconds.
- Parameters
-
| p_o | Other duration to compare. |
- Returns
- true when this duration is longer.
◆ operator>=()
| bool spk::Duration::operator>= |
( |
const Duration & | p_o | ) |
const |
Greater-or-equal comparison using canonical nanoseconds.
- Parameters
-
| p_o | Other duration to compare. |
- Returns
- true when this duration is longer or equal.
◆ seconds()
| double spk::Duration::seconds |
( |
| ) |
const |
Returns the duration in seconds.
- Returns
- Duration value expressed in seconds.
The documentation for this class was generated from the following files:
- includes/structure/system/time/spk_duration.hpp
- srcs/structure/system/time/spk_duration.cpp