Represents a duration.
More...
#include <ArmarXCore/core/time/Duration.h>
Represents a duration.
API and implementation to match IceUtil::Time (where applicable).
Definition at line 16 of file Duration.h.
◆ Duration() [1/2]
Constructs a zero-duration.
Definition at line 13 of file Duration.cpp.
◆ Duration() [2/2]
◆ Days()
◆ DaysDouble()
◆ Hours()
◆ HoursDouble()
◆ isPositive()
| bool isPositive |
( |
| ) |
const |
Tests whether the duration is positive (value in µs > 0).
- Returns
- True if duration is positive, else otherwise.
Definition at line 168 of file Duration.cpp.
◆ isZero()
◆ MicroSeconds()
| Duration MicroSeconds |
( |
std::int64_t | microSeconds | ) |
|
|
static |
Constructs a duration in microseconds.
- Parameters
-
| microSeconds | Amount of microseconds. |
- Returns
- Duration instance.
Definition at line 24 of file Duration.cpp.
◆ MicroSecondsDouble()
| Duration MicroSecondsDouble |
( |
double | microSeconds | ) |
|
|
static |
Constructs a duration in microseconds.
- Parameters
-
| microSeconds | Amount of microseconds. |
- Returns
- Duration instance.
Definition at line 30 of file Duration.cpp.
◆ MilliSeconds()
| Duration MilliSeconds |
( |
std::int64_t | milliSeconds | ) |
|
|
static |
Constructs a duration in milliseconds.
- Parameters
-
| milliSeconds | Amount of milliseconds. |
- Returns
- Duration instance.
Definition at line 48 of file Duration.cpp.
◆ MilliSecondsDouble()
| Duration MilliSecondsDouble |
( |
double | milliSeconds | ) |
|
|
static |
Constructs a duration in milliseconds.
- Parameters
-
| milliSeconds | Amount of milliseconds. |
- Returns
- Duration instance.
Definition at line 54 of file Duration.cpp.
◆ Minutes()
| Duration Minutes |
( |
std::int64_t | minutes | ) |
|
|
static |
Constructs a duration in minutes.
- Parameters
-
| minutes | Amount of minutes. |
- Returns
- Duration instance.
Definition at line 96 of file Duration.cpp.
◆ MinutesDouble()
| Duration MinutesDouble |
( |
double | minutes | ) |
|
|
static |
Constructs a duration in minutes.
- Parameters
-
| minutes | Amount of minutes. |
- Returns
- Duration instance.
Definition at line 102 of file Duration.cpp.
◆ operator!=()
| bool operator!= |
( |
const Duration & | rhs | ) |
const |
◆ operator*() [1/3]
◆ operator*() [2/3]
◆ operator*() [3/3]
| Duration operator* |
( |
std::int64_t | rhs | ) |
const |
◆ operator*=() [1/3]
◆ operator*=() [2/3]
◆ operator*=() [3/3]
| Duration & operator*= |
( |
std::int64_t | rhs | ) |
|
◆ operator+()
◆ operator+=()
◆ operator-() [1/2]
◆ operator-() [2/2]
◆ operator-=()
◆ operator/() [1/4]
| double operator/ |
( |
const Duration & | rhs | ) |
const |
◆ operator/() [2/4]
◆ operator/() [3/4]
◆ operator/() [4/4]
| Duration operator/ |
( |
std::int64_t | rhs | ) |
const |
◆ operator/=() [1/3]
◆ operator/=() [2/3]
◆ operator/=() [3/3]
| Duration & operator/= |
( |
std::int64_t | rhs | ) |
|
◆ operator<()
| bool operator< |
( |
const Duration & | rhs | ) |
const |
◆ operator<=()
| bool operator<= |
( |
const Duration & | rhs | ) |
const |
◆ operator==()
| bool operator== |
( |
const Duration & | rhs | ) |
const |
◆ operator>()
| bool operator> |
( |
const Duration & | rhs | ) |
const |
◆ operator>=()
| bool operator>= |
( |
const Duration & | rhs | ) |
const |
◆ Seconds()
| Duration Seconds |
( |
std::int64_t | seconds | ) |
|
|
static |
Constructs a duration in seconds.
- Parameters
-
| seconds | Amount of seconds. |
- Returns
- Duration instance.
Definition at line 72 of file Duration.cpp.
◆ SecondsDouble()
| Duration SecondsDouble |
( |
double | seconds | ) |
|
|
static |
Constructs a duration in seconds.
- Parameters
-
| seconds | Amount of seconds. |
- Returns
- Duration instance.
Definition at line 78 of file Duration.cpp.
◆ toDays()
| std::int64_t toDays |
( |
| ) |
const |
Returns the amount of days.
- Returns
- Amount of days.
Definition at line 156 of file Duration.cpp.
◆ toDaysDouble()
| double toDaysDouble |
( |
| ) |
const |
Returns the amount of days.
- Returns
- Amount of days.
Definition at line 162 of file Duration.cpp.
◆ toDurationString() [1/2]
| std::string toDurationString |
( |
| ) |
const |
String representation of the current duration in minimal/default format.
The minimal representation is a float representation with max. 3 decimals. The unit will be determined by the highest unit whose value is non-zero. For example, 3 seconds and 500 milliseconds => "3.5s".
- Returns
- Formatted duration.
Definition at line 180 of file Duration.cpp.
◆ toDurationString() [2/2]
| std::string toDurationString |
( |
const std::string & | format | ) |
const |
String representation of the current duration according to given format string.
The format is according to https://en.cppreference.com/w/cpp/chrono/c/strftime. For milli seconds and micro seconds, special specifiers "%%msec" and "%%usec" were added respectively.
Example format string for "10m 10.987s": "%Mm %S.%%msecs".
- Parameters
-
- Returns
- Formatted duration.
Definition at line 221 of file Duration.cpp.
◆ toHours()
| std::int64_t toHours |
( |
| ) |
const |
Returns the amount of hours.
- Returns
- Amount of hours.
Definition at line 132 of file Duration.cpp.
◆ toHoursDouble()
| double toHoursDouble |
( |
| ) |
const |
Returns the amount of hours.
- Returns
- Amount of hours.
Definition at line 138 of file Duration.cpp.
◆ toMicroSeconds()
| std::int64_t toMicroSeconds |
( |
| ) |
const |
Returns the amount of microseconds.
- Returns
- Amount of microseconds.
Definition at line 36 of file Duration.cpp.
◆ toMicroSecondsDouble()
| double toMicroSecondsDouble |
( |
| ) |
const |
Returns the amount of microseconds.
- Returns
- Amount of microseconds.
Definition at line 42 of file Duration.cpp.
◆ toMilliSeconds()
| std::int64_t toMilliSeconds |
( |
| ) |
const |
Returns the amount of milliseconds.
- Returns
- Amount of milliseconds.
Definition at line 60 of file Duration.cpp.
◆ toMilliSecondsDouble()
| double toMilliSecondsDouble |
( |
| ) |
const |
Returns the amount of milliseconds.
- Returns
- Amount of milliseconds.
Definition at line 66 of file Duration.cpp.
◆ toMinutes()
| std::int64_t toMinutes |
( |
| ) |
const |
Returns the amount of minutes.
- Returns
- Amount of minutes.
Definition at line 108 of file Duration.cpp.
◆ toMinutesDouble()
| double toMinutesDouble |
( |
| ) |
const |
Returns the amount of minutes.
- Returns
- Amount of minutes.
Definition at line 114 of file Duration.cpp.
◆ toSeconds()
| std::int64_t toSeconds |
( |
| ) |
const |
Returns the amount of seconds.
- Returns
- Amount of seconds.
Definition at line 84 of file Duration.cpp.
◆ toSecondsDouble()
| double toSecondsDouble |
( |
| ) |
const |
Returns the amount of seconds.
- Returns
- Amount of seconds.
Definition at line 90 of file Duration.cpp.
◆ _microSeconds
| std::int64_t _microSeconds |
|
protected |
Current duration in microseconds.
Definition at line 270 of file Duration.h.
The documentation for this class was generated from the following files: