Represents a duration with millisecond resolution. More...
#include <duration.h>
Public Member Functions | |
Duration () noexcept | |
Creates a new Duration instance with zero milliseconds. More... | |
Duration (uint64_t milliseconds) noexcept | |
Creates a new Duration instance from the given number of milliseconds. More... | |
Duration (std::chrono::duration< uint64_t, std::milli > duration) noexcept | |
Creates a new Duration instance from an std::chrono::duration. More... | |
Duration (const Duration &)=default | |
Creates a copy of a Duration instance. More... | |
operator std::chrono::duration< uint64_t, std::milli > () const noexcept | |
Returns the stored duration as an std::chrono::duration. More... | |
Duration & | operator= (const Duration &)=default |
Assigns the contents of one Duration to another. More... | |
uint64_t | toMSec () const noexcept |
Returns the stored duration in . More... | |
double | toSec () const noexcept |
Returns the stored duration in . More... | |
Arithmetic operators | |
Duration | operator+ (const Duration &rhs) const noexcept |
Performs addition. More... | |
Duration & | operator+= (const Duration &rhs) noexcept |
Performs addition. More... | |
Duration | operator- (const Duration &rhs) const noexcept |
Performs subtraction. More... | |
Duration & | operator-= (const Duration &rhs) noexcept |
Performs subtraction. More... | |
Duration | operator* (uint64_t rhs) const noexcept |
Performs multiplication. More... | |
Duration & | operator*= (uint64_t rhs) noexcept |
Performs multiplication. More... | |
uint64_t | operator/ (const Duration &rhs) const noexcept |
Performs division. More... | |
Duration | operator/ (uint64_t rhs) const noexcept |
Performs division. More... | |
Duration & | operator/= (uint64_t rhs) noexcept |
Performs division. More... | |
Duration | operator% (const Duration &rhs) const noexcept |
Performs the modulo operation. More... | |
Duration | operator% (uint64_t rhs) const noexcept |
Performs the modulo operation. More... | |
Duration & | operator%= (const Duration &rhs) noexcept |
Performs the modulo operation. More... | |
Duration & | operator%= (uint64_t rhs) noexcept |
Performs the modulo operation. More... | |
Comparison operators | |
bool | operator== (const Duration &rhs) const noexcept |
Compares two durations for equality. More... | |
bool | operator!= (const Duration &rhs) const noexcept |
Compares two durations for inequality. More... | |
bool | operator< (const Duration &rhs) const noexcept |
Compares two durations. More... | |
bool | operator<= (const Duration &rhs) const noexcept |
Compares two durations. More... | |
bool | operator> (const Duration &rhs) const noexcept |
Compares two durations. More... | |
bool | operator>= (const Duration &rhs) const noexcept |
Compares two durations. More... | |
Private Attributes | |
std::chrono::duration< uint64_t, std::milli > | duration_ |
Represents a duration with millisecond resolution.
Definition at line 19 of file duration.h.
|
noexcept |
Creates a new Duration instance with zero milliseconds.
|
explicitnoexcept |
Creates a new Duration instance from the given number of milliseconds.
[in] | milliseconds | Number of milliseconds. |
|
noexcept |
|
noexcept |
Returns the stored duration as an std::chrono::duration.
|
noexcept |
Compares two durations for inequality.
[in] | rhs | Right-hand side of the comparison. |
Performs the modulo operation.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs the modulo operation.
[in] | rhs | Right-hand side of the operation. |
Performs the modulo operation.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs the modulo operation.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs multiplication.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs multiplication.
[in] | rhs | Right-hand side of the operation. |
Performs addition.
[in] | rhs | Right-hand side of the operation. |
Performs addition.
[in] | rhs | Right-hand side of the operation. |
Performs subtraction.
[in] | rhs | Right-hand side of the operation. |
Performs subtraction.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs division.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs division.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Performs division.
[in] | rhs | Right-hand side of the operation. |
|
noexcept |
Compares two durations.
[in] | rhs | Right-hand side of the comparison. |
|
noexcept |
Compares two durations.
[in] | rhs | Right-hand side of the comparison. |
Assigns the contents of one Duration to another.
|
noexcept |
Compares two durations for equality.
[in] | rhs | Right-hand side of the comparison. |
|
noexcept |
Compares two durations.
[in] | rhs | Right-hand side of the comparison. |
|
noexcept |
Compares two durations.
[in] | rhs | Right-hand side of the comparison. |
|
noexcept |
Returns the stored duration in .
|
noexcept |
Returns the stored duration in .
|
private |
Definition at line 252 of file duration.h.