Time duration with nanosecond precision. More...
#include <duration.h>
Public Member Functions | |
| Duration () | |
| Default constructor. Creates a zero duration. | |
| int64_t | hours () const |
| Returns the total number of whole hours. | |
| int64_t | minutes () const |
| Returns the total number of whole minutes. | |
| int64_t | seconds () const |
| Returns the total number of whole seconds. | |
| int64_t | milliseconds () const |
| Returns the total number of whole milliseconds. | |
| int64_t | microseconds () const |
| Returns the total number of whole microseconds. | |
| int64_t | nanoseconds () const |
| Returns the total number of nanoseconds. | |
| double | toSecondsDouble () const |
| Returns the duration as a fractional number of seconds. | |
| bool | isZero () const |
| Returns true if the duration is exactly zero. | |
| bool | isNegative () const |
| Returns true if the duration is negative. | |
| String | toString () const |
| Returns a human-readable representation (e.g. "1h 23m 45s"). | |
| Duration | operator+ (const Duration &o) const |
| Addition operator. | |
| Duration | operator- (const Duration &o) const |
| Subtraction operator. | |
| Duration | operator* (int64_t s) const |
| Scalar multiplication operator. | |
| Duration | operator/ (int64_t s) const |
| Scalar division operator. | |
| bool | operator== (const Duration &o) const |
| Equality comparison. | |
| bool | operator!= (const Duration &o) const |
| Inequality comparison. | |
| bool | operator< (const Duration &o) const |
| Less-than comparison. | |
| bool | operator> (const Duration &o) const |
| Greater-than comparison. | |
| bool | operator<= (const Duration &o) const |
| Less-than-or-equal comparison. | |
| bool | operator>= (const Duration &o) const |
| Greater-than-or-equal comparison. | |
Static Public Member Functions | |
| static Duration | fromHours (int64_t h) |
| Creates a Duration from hours. | |
| static Duration | fromMinutes (int64_t m) |
| Creates a Duration from minutes. | |
| static Duration | fromSeconds (int64_t s) |
| Creates a Duration from seconds. | |
| static Duration | fromMilliseconds (int64_t ms) |
| Creates a Duration from milliseconds. | |
| static Duration | fromMicroseconds (int64_t us) |
| Creates a Duration from microseconds. | |
| static Duration | fromNanoseconds (int64_t ns) |
| Creates a Duration from nanoseconds. | |
Time duration with nanosecond precision.
Simple value type wrapping std::chrono::nanoseconds. Provides static factories for construction and accessors for various time units. No PROMEKI_SHARED_FINAL.
|
inline |
Returns the total number of whole hours.
|
inline |
Returns true if the duration is negative.
|
inline |
Returns true if the duration is exactly zero.
|
inline |
Returns the total number of whole microseconds.
|
inline |
Returns the total number of whole milliseconds.
|
inline |
Returns the total number of whole minutes.
|
inline |
Returns the total number of nanoseconds.
|
inline |
Returns the total number of whole seconds.
|
inline |
Returns the duration as a fractional number of seconds.
| String Duration::toString | ( | ) | const |
Returns a human-readable representation (e.g. "1h 23m 45s").