Class Duration
Defined in File duration.h
Class Documentation
-
class Duration
Represents a duration with millisecond resolution.
Arithmetic operators
-
Duration operator+(const Duration &rhs) const noexcept
Performs addition.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
-
Duration &operator+=(const Duration &rhs) noexcept
Performs addition.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
This duration.
-
Duration operator-(const Duration &rhs) const noexcept
Performs subtraction.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
-
Duration &operator-=(const Duration &rhs) noexcept
Performs subtraction.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
This duration.
-
Duration operator*(uint64_t rhs) const noexcept
Performs multiplication.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
-
Duration &operator*=(uint64_t rhs) noexcept
Performs multiplication.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
This duration.
-
uint64_t operator/(const Duration &rhs) const noexcept
Performs division.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
-
Duration operator/(uint64_t rhs) const noexcept
Performs division.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
-
Duration &operator/=(uint64_t rhs) noexcept
Performs division.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
This duration.
-
Duration operator%(const Duration &rhs) const noexcept
Performs the modulo operation.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
-
Duration operator%(uint64_t rhs) const noexcept
Performs the modulo operation.
- Parameters:
rhs – [in] Right-hand side of the operation.
- Returns:
Result of the operation.
Comparison operators
-
bool operator==(const Duration &rhs) const noexcept
Compares two durations for equality.
- Parameters:
rhs – [in] Right-hand side of the comparison.
- Returns:
True if the duration are equal, false otherwise.
-
bool operator!=(const Duration &rhs) const noexcept
Compares two durations for inequality.
- Parameters:
rhs – [in] Right-hand side of the comparison.
- Returns:
True if the duration are not equal, false otherwise.
-
bool operator<(const Duration &rhs) const noexcept
Compares two durations.
- Parameters:
rhs – [in] Right-hand side of the comparison.
- Returns:
True if this duration is shorter than rhs, false otherwise.
-
bool operator<=(const Duration &rhs) const noexcept
Compares two durations.
- Parameters:
rhs – [in] Right-hand side of the comparison.
- Returns:
True if this duration is shorter than or equal to rhs, false otherwise.
Public Functions
-
explicit Duration(uint64_t milliseconds) noexcept
Creates a new Duration instance from the given number of milliseconds.
- Parameters:
milliseconds – [in] Number of milliseconds.
-
Duration(std::chrono::duration<uint64_t, std::milli> duration) noexcept
Creates a new Duration instance from an std::chrono::duration.
- Parameters:
duration – [in] Duration.
-
Duration &operator=(const Duration&) = default
Assigns the contents of one Duration to another.
- Returns:
Result of the operation.
-
Duration operator+(const Duration &rhs) const noexcept