|
Represents a duration. More...
#include <ArmarXCore/core/time/Duration.h>
Public Member Functions | |
Duration () | |
Constructs a zero-duration. More... | |
bool | isPositive () const |
Tests whether the duration is positive (value in µs > 0). More... | |
bool | isZero () const |
bool | operator!= (const Duration &rhs) const |
Duration | operator* (double rhs) const |
Duration | operator* (int rhs) const |
Duration | operator* (std::int64_t rhs) const |
Duration & | operator*= (double rhs) |
Duration & | operator*= (int rhs) |
Duration & | operator*= (std::int64_t rhs) |
Duration | operator+ (const Duration &rhs) const |
Duration & | operator+= (const Duration &rhs) |
Duration | operator- () const |
Duration | operator- (const Duration &rhs) const |
Duration & | operator-= (const Duration &rhs) |
double | operator/ (const Duration &rhs) const |
Duration | operator/ (double rhs) const |
Duration | operator/ (int rhs) const |
Duration | operator/ (std::int64_t rhs) const |
Duration & | operator/= (double rhs) |
Duration & | operator/= (int rhs) |
Duration & | operator/= (std::int64_t rhs) |
bool | operator< (const Duration &rhs) const |
bool | operator<= (const Duration &rhs) const |
bool | operator== (const Duration &rhs) const |
bool | operator> (const Duration &rhs) const |
bool | operator>= (const Duration &rhs) const |
std::int64_t | toDays () const |
Returns the amount of days. More... | |
double | toDaysDouble () const |
Returns the amount of days. More... | |
std::string | toDurationString () const |
String representation of the current duration in minimal/default format. More... | |
std::string | toDurationString (const std::string &format) const |
String representation of the current duration according to given format string. More... | |
std::int64_t | toHours () const |
Returns the amount of hours. More... | |
double | toHoursDouble () const |
Returns the amount of hours. More... | |
std::int64_t | toMicroSeconds () const |
Returns the amount of microseconds. More... | |
double | toMicroSecondsDouble () const |
Returns the amount of microseconds. More... | |
std::int64_t | toMilliSeconds () const |
Returns the amount of milliseconds. More... | |
double | toMilliSecondsDouble () const |
Returns the amount of milliseconds. More... | |
std::int64_t | toMinutes () const |
Returns the amount of minutes. More... | |
double | toMinutesDouble () const |
Returns the amount of minutes. More... | |
std::int64_t | toSeconds () const |
Returns the amount of seconds. More... | |
double | toSecondsDouble () const |
Returns the amount of seconds. More... | |
Static Public Member Functions | |
static Duration | Days (std::int64_t days) |
Constructs a duration in days. More... | |
static Duration | DaysDouble (double days) |
Constructs a duration in days. More... | |
static Duration | Hours (std::int64_t hours) |
Constructs a duration in hours. More... | |
static Duration | HoursDouble (double hours) |
Constructs a duration in hours. More... | |
static Duration | MicroSeconds (std::int64_t microSeconds) |
Constructs a duration in microseconds. More... | |
static Duration | MicroSecondsDouble (double microSeconds) |
Constructs a duration in microseconds. More... | |
static Duration | MilliSeconds (std::int64_t milliSeconds) |
Constructs a duration in milliseconds. More... | |
static Duration | MilliSecondsDouble (double milliSeconds) |
Constructs a duration in milliseconds. More... | |
static Duration | Minutes (std::int64_t minutes) |
Constructs a duration in minutes. More... | |
static Duration | MinutesDouble (double minutes) |
Constructs a duration in minutes. More... | |
static Duration | Seconds (std::int64_t seconds) |
Constructs a duration in seconds. More... | |
static Duration | SecondsDouble (double seconds) |
Constructs a duration in seconds. More... | |
Protected Member Functions | |
Duration (std::int64_t microSeconds) | |
Protected Attributes | |
std::int64_t | _microSeconds |
Current duration in microseconds. More... | |
Represents a duration.
API and implementation to match IceUtil::Time (where applicable).
Definition at line 17 of file Duration.h.
Duration | ( | ) |
Constructs a zero-duration.
Definition at line 14 of file Duration.cpp.
|
protected |
Definition at line 20 of file Duration.cpp.
|
static |
Constructs a duration in days.
days | Amount of days. |
Definition at line 167 of file Duration.cpp.
|
static |
Constructs a duration in days.
days | Amount of days. |
Definition at line 174 of file Duration.cpp.
|
static |
Constructs a duration in hours.
hours | Amount of hours. |
Definition at line 139 of file Duration.cpp.
|
static |
Constructs a duration in hours.
hours | Amount of hours. |
Definition at line 146 of file Duration.cpp.
bool isPositive | ( | ) | const |
Tests whether the duration is positive (value in µs > 0).
Definition at line 195 of file Duration.cpp.
bool isZero | ( | ) | const |
|
static |
Constructs a duration in microseconds.
microSeconds | Amount of microseconds. |
Definition at line 27 of file Duration.cpp.
|
static |
Constructs a duration in microseconds.
microSeconds | Amount of microseconds. |
Definition at line 34 of file Duration.cpp.
|
static |
Constructs a duration in milliseconds.
milliSeconds | Amount of milliseconds. |
Definition at line 55 of file Duration.cpp.
|
static |
Constructs a duration in milliseconds.
milliSeconds | Amount of milliseconds. |
Definition at line 62 of file Duration.cpp.
|
static |
Constructs a duration in minutes.
minutes | Amount of minutes. |
Definition at line 111 of file Duration.cpp.
|
static |
Constructs a duration in minutes.
minutes | Amount of minutes. |
Definition at line 118 of file Duration.cpp.
bool operator!= | ( | const Duration & | rhs | ) | const |
Definition at line 430 of file Duration.cpp.
Duration operator* | ( | double | rhs | ) | const |
Definition at line 312 of file Duration.cpp.
Duration operator* | ( | int | rhs | ) | const |
Definition at line 321 of file Duration.cpp.
Duration operator* | ( | std::int64_t | rhs | ) | const |
Definition at line 328 of file Duration.cpp.
Duration & operator*= | ( | double | rhs | ) |
Definition at line 335 of file Duration.cpp.
Duration & operator*= | ( | int | rhs | ) |
Definition at line 343 of file Duration.cpp.
Duration & operator*= | ( | std::int64_t | rhs | ) |
Definition at line 350 of file Duration.cpp.
Definition at line 275 of file Duration.cpp.
Definition at line 282 of file Duration.cpp.
Duration operator- | ( | ) | const |
Definition at line 290 of file Duration.cpp.
Definition at line 297 of file Duration.cpp.
Definition at line 304 of file Duration.cpp.
double operator/ | ( | const Duration & | rhs | ) | const |
Definition at line 357 of file Duration.cpp.
Duration operator/ | ( | double | rhs | ) | const |
Definition at line 364 of file Duration.cpp.
Duration operator/ | ( | int | rhs | ) | const |
Definition at line 373 of file Duration.cpp.
Duration operator/ | ( | std::int64_t | rhs | ) | const |
Definition at line 380 of file Duration.cpp.
Duration & operator/= | ( | double | rhs | ) |
Definition at line 387 of file Duration.cpp.
Duration & operator/= | ( | int | rhs | ) |
Definition at line 395 of file Duration.cpp.
Duration & operator/= | ( | std::int64_t | rhs | ) |
Definition at line 402 of file Duration.cpp.
bool operator< | ( | const Duration & | rhs | ) | const |
Definition at line 409 of file Duration.cpp.
bool operator<= | ( | const Duration & | rhs | ) | const |
Definition at line 416 of file Duration.cpp.
bool operator== | ( | const Duration & | rhs | ) | const |
Definition at line 423 of file Duration.cpp.
bool operator> | ( | const Duration & | rhs | ) | const |
Definition at line 444 of file Duration.cpp.
bool operator>= | ( | const Duration & | rhs | ) | const |
Definition at line 437 of file Duration.cpp.
|
static |
Constructs a duration in seconds.
seconds | Amount of seconds. |
Definition at line 83 of file Duration.cpp.
|
static |
Constructs a duration in seconds.
seconds | Amount of seconds. |
Definition at line 90 of file Duration.cpp.
std::int64_t toDays | ( | ) | const |
Returns the amount of days.
Definition at line 181 of file Duration.cpp.
double toDaysDouble | ( | ) | const |
Returns the amount of days.
Definition at line 188 of file Duration.cpp.
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".
Definition at line 209 of file Duration.cpp.
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".
format | Format string. |
Definition at line 251 of file Duration.cpp.
std::int64_t toHours | ( | ) | const |
Returns the amount of hours.
Definition at line 153 of file Duration.cpp.
double toHoursDouble | ( | ) | const |
Returns the amount of hours.
Definition at line 160 of file Duration.cpp.
std::int64_t toMicroSeconds | ( | ) | const |
Returns the amount of microseconds.
Definition at line 41 of file Duration.cpp.
double toMicroSecondsDouble | ( | ) | const |
Returns the amount of microseconds.
Definition at line 48 of file Duration.cpp.
std::int64_t toMilliSeconds | ( | ) | const |
Returns the amount of milliseconds.
Definition at line 69 of file Duration.cpp.
double toMilliSecondsDouble | ( | ) | const |
Returns the amount of milliseconds.
Definition at line 76 of file Duration.cpp.
std::int64_t toMinutes | ( | ) | const |
Returns the amount of minutes.
Definition at line 125 of file Duration.cpp.
double toMinutesDouble | ( | ) | const |
Returns the amount of minutes.
Definition at line 132 of file Duration.cpp.
std::int64_t toSeconds | ( | ) | const |
Returns the amount of seconds.
Definition at line 97 of file Duration.cpp.
double toSecondsDouble | ( | ) | const |
Returns the amount of seconds.
Definition at line 104 of file Duration.cpp.
|
protected |
Current duration in microseconds.
Definition at line 271 of file Duration.h.