This inner class of TimePointBase represents durations, hence difference values of two values of the parent class.
Often, objects of this class are generated by the subtraction of TimePointBase values or by using methods Duration Age() const and Duration Since(const TDerived&) const. Furthermore, the class CalendarDuration (found in the module ALib Strings) can be used to convert durations to and from human-readable units (days, hours, minutes, etc.).
class TimePointBase
Definition at line 77 of file timepointbase.hpp.
#include <timepointbase.hpp>
Public Type Index: | |
| using | TDuration = sc steady_clock::duration |
| The value type for time spans. | |
Public Static Method Index: | |
| static Duration | FromAbsoluteDays (int64_t days) |
| static Duration | FromAbsoluteHours (int64_t hours) |
| static Duration | FromAbsoluteMicroseconds (int64_t microseconds) |
| static Duration | FromAbsoluteMilliseconds (int64_t milliseconds) |
| static Duration | FromAbsoluteMinutes (int64_t minutes) |
| static Duration | FromAbsoluteSeconds (int64_t seconds) |
| static Duration | FromDays (double days) |
| static Duration | FromHours (double hours) |
| static Duration | FromMicroseconds (double microseconds) |
| static Duration | FromMilliseconds (double milliseconds) |
| static Duration | FromMinutes (double minutes) |
| static Duration | FromNanoseconds (int64_t nanoseconds) |
| static Duration | FromSeconds (double seconds) |
| static Duration | Import (const TDuration &timeSpan) |
Public Method Index: | |
| constexpr | Duration () |
| Creates a zero-length time span. | |
| Duration (const TDuration &stdLibValue) | |
| TDuration | Export () const |
| integer | InAbsoluteDays () const |
| integer | InAbsoluteHours () const |
| int64_t | InAbsoluteMicroseconds () const |
| int64_t | InAbsoluteMilliseconds () const |
| int64_t | InAbsoluteMinutes () const |
| int64_t | InAbsoluteSeconds () const |
| double | InDays () const |
| double | InHertz (int qtyFractionalDigits=-1) const |
| double | InHours () const |
| double | InMicroseconds () const |
| double | InMilliseconds () const |
| double | InMinutes () const |
| int64_t | InNanoseconds () const |
| double | InSeconds () const |
| bool | IsPositive () const |
| bool | IsZero () const |
| bool | operator!= (const Duration &other) const |
| bool | operator!= (const TDuration &other) const |
| Duration | operator* (double multiplier) const |
| Duration | operator* (int64_t multiplier) const |
| Duration & | operator*= (double multiplier) |
| Duration & | operator*= (int64_t multiplier) |
| Duration | operator+ (const Duration &rhs) const |
| Duration | operator+ (const TDuration &rhs) const |
| Duration & | operator+= (const Duration &other) |
| Duration & | operator+= (const TDuration &other) |
| Duration | operator- (const Duration &rhs) const |
| Duration | operator- (const TDuration &rhs) const |
| Duration & | operator-= (const Duration &other) |
| Duration & | operator-= (const TDuration &other) |
| Duration | operator/ (double divisor) const |
| Duration | operator/ (int64_t divisor) const |
| Duration & | operator/= (double divisor) |
| Duration & | operator/= (int64_t divisor) |
| bool | operator< (const Duration &other) const |
| bool | operator< (const TDuration &other) const |
| bool | operator<= (const Duration &other) const |
| bool | operator<= (const TDuration &other) const |
| Duration & | operator= (const TDuration &stdLibValue) |
| bool | operator== (const Duration &other) const |
| bool | operator== (const TDuration &other) const |
| bool | operator> (const Duration &other) const |
| bool | operator> (const TDuration &other) const |
| bool | operator>= (const Duration &other) const |
| bool | operator>= (const TDuration &other) const |
| Duration & | SetMaximum (const Duration &other) |
| Duration & | SetMinimum (const Duration &other) |
Protected Field Index: | |
| TDuration | span |
| The internal time value. | |
| using alib::time::TimePointBase< TClock, TDerived >::Duration::TDuration = sc steady_clock::duration |
The value type for time spans.
Definition at line 86 of file timepointbase.hpp.
|
protected |
The internal time value.
Definition at line 94 of file timepointbase.hpp.
|
inlineconstexpr |
Creates a zero-length time span.
Definition at line 103 of file timepointbase.hpp.
|
inline |
Constructs an instance from C++ library values.
| stdLibValue | The value to copy into this. |
Definition at line 109 of file timepointbase.hpp.
|
inline |
Returns the internal time span value using the C++ standard library format.
Definition at line 124 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in days.
| days | The time span to set in days. |
*this to allow concatenated calls. Definition at line 427 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in hours.
| hours | The time span to set in hours. |
*this to allow concatenated calls. Definition at line 441 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in microseconds.
| microseconds | The time span to set in microseconds. |
*this to allow concatenated calls. Definition at line 497 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in milliseconds.
| milliseconds | The time span to set in milliseconds. |
*this to allow concatenated calls. Definition at line 483 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in hours.
| minutes | The time span to set in minutes. |
*this to allow concatenated calls. Definition at line 455 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in seconds.
| seconds | The time span to set in seconds. |
*this to allow concatenated calls. Definition at line 469 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in days.
| days | The time span to set in days. |
*this to allow concatenated calls. Definition at line 420 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in hours.
| hours | The time span to set in hours. |
*this to allow concatenated calls. Definition at line 434 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in microseconds.
| microseconds | The time span to set in microseconds. |
*this to allow concatenated calls. Definition at line 490 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in milliseconds.
| milliseconds | The time span to set in milliseconds. |
*this to allow concatenated calls. Definition at line 476 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in hours.
| minutes | The time span to set in minutes. |
*this to allow concatenated calls. Definition at line 448 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in nanoseconds.
| nanoseconds | The time span to set in nanoseconds. |
*this to allow concatenated calls. Definition at line 504 of file timepointbase.hpp.
|
inlinestatic |
Sets the internal value to a time span provided in seconds.
| seconds | The time span to set in seconds. |
*this to allow concatenated calls. Definition at line 462 of file timepointbase.hpp.
|
inlinestatic |
Creates an instance representing the time span given in C++ standard library format.
| timeSpan | The C++ time point value. |
Definition at line 130 of file timepointbase.hpp.
|
inline |
Converts the internal value to absolute days.
Definition at line 322 of file timepointbase.hpp.
|
inline |
Converts the internal value to absolute hours.
Definition at line 336 of file timepointbase.hpp.
|
inline |
Converts the internal value to absolute microseconds.
Definition at line 384 of file timepointbase.hpp.
|
inline |
Converts the internal value to absolute milliseconds.
Definition at line 372 of file timepointbase.hpp.
|
inline |
Converts the internal value to absolute minutes.
Definition at line 348 of file timepointbase.hpp.
|
inline |
Converts the internal value to absolute seconds.
Definition at line 360 of file timepointbase.hpp.
|
inline |
Converts the internal value to days.
Definition at line 315 of file timepointbase.hpp.
|
inline |
Returns 1 divided by internal value in seconds, hence the number of Hertz that this object represents when interpreted as a time span.
| qtyFractionalDigits | Number of digits that the return value will be rounded to. Defaults to -1 which means no rounding. |
Definition at line 398 of file timepointbase.hpp.
|
inline |
Converts the internal value to hours.
Definition at line 329 of file timepointbase.hpp.
|
inline |
Converts the internal value to microseconds.
Definition at line 377 of file timepointbase.hpp.
|
inline |
Converts the internal value to milliseconds.
Definition at line 365 of file timepointbase.hpp.
|
inline |
Converts the internal value to minutes.
Definition at line 341 of file timepointbase.hpp.
|
inline |
Converts the internal value to nanoseconds.
Definition at line 389 of file timepointbase.hpp.
|
inline |
Converts the internal value to seconds.
Definition at line 353 of file timepointbase.hpp.
|
inline |
true if this is a positive duration, false otherwise. Definition at line 152 of file timepointbase.hpp.
|
inline |
true if this is a zero-length time-span, false otherwise. Definition at line 155 of file timepointbase.hpp.
|
inline |
Not equal to operator.
| other | The duration to compare. |
Definition at line 171 of file timepointbase.hpp.
|
inline |
Not equal to operator.
| other | The duration to compare. |
Definition at line 176 of file timepointbase.hpp.
|
inline |
Multiply operator.
| multiplier | The multiplier. |
Definition at line 261 of file timepointbase.hpp.
|
inline |
Multiply operator.
| multiplier | The multiplier. |
Definition at line 267 of file timepointbase.hpp.
|
inline |
Assignment by product operator.
| multiplier | The multiplier. |
Definition at line 273 of file timepointbase.hpp.
|
inline |
Assignment by product operator.
| multiplier | The multiplier. |
Definition at line 279 of file timepointbase.hpp.
|
inline |
Addition operator.
| rhs | The right-hand side time span to add. |
Definition at line 221 of file timepointbase.hpp.
|
inline |
Addition operator.
| rhs | The right-hand side time span to add. |
Definition at line 226 of file timepointbase.hpp.
|
inline |
Assignment by sum operator.
| other | The time span to subtract. |
Definition at line 231 of file timepointbase.hpp.
|
inline |
Assignment by sum operator.
| other | The time span to subtract. |
Definition at line 236 of file timepointbase.hpp.
|
inline |
Subtraction operator.
| rhs | The right-hand side time span to subtract. |
Definition at line 241 of file timepointbase.hpp.
|
inline |
Subtraction operator.
| rhs | The right-hand side time span to subtract. |
Definition at line 246 of file timepointbase.hpp.
|
inline |
Assignment by difference operator.
| other | The time span subtract. |
Definition at line 251 of file timepointbase.hpp.
|
inline |
Assignment by difference operator.
| other | The time span subtract. |
Definition at line 256 of file timepointbase.hpp.
|
inline |
Divide operator.
| divisor | The divisor. |
Definition at line 285 of file timepointbase.hpp.
|
inline |
Divide operator.
| divisor | The divisor. |
Definition at line 291 of file timepointbase.hpp.
|
inline |
Assignment by quotient operator.
| divisor | The divisor. |
Definition at line 297 of file timepointbase.hpp.
|
inline |
Assignment by quotient operator.
| divisor | The divisor. |
Definition at line 304 of file timepointbase.hpp.
|
inline |
Less than operator.
| other | The duration to compare. |
Definition at line 181 of file timepointbase.hpp.
|
inline |
Less than operator.
| other | The duration to compare. |
Definition at line 186 of file timepointbase.hpp.
|
inline |
Less than or equal to operator.
| other | The duration to compare. |
Definition at line 191 of file timepointbase.hpp.
|
inline |
Less than or equal to operator.
| other | The duration to compare. |
Definition at line 196 of file timepointbase.hpp.
|
inline |
Constructs an instance from C++ library values.
| stdLibValue | The value to copy into this. |
Definition at line 116 of file timepointbase.hpp.
|
inline |
Equal to operator.
| other | The duration to compare. |
Definition at line 160 of file timepointbase.hpp.
|
inline |
Equal to operator.
| other | The duration to compare. |
Definition at line 166 of file timepointbase.hpp.
|
inline |
Greater than operator.
| other | The duration to compare. |
Definition at line 201 of file timepointbase.hpp.
|
inline |
Greater than operator.
| other | The duration to compare. |
Definition at line 206 of file timepointbase.hpp.
|
inline |
Greater than or equal to operator.
| other | The duration to compare. |
Definition at line 211 of file timepointbase.hpp.
|
inline |
Greater than or equal to operator.
| other | The duration to compare. |
Definition at line 216 of file timepointbase.hpp.
|
inline |
Sets this object's value to the given duration, in the case the given is longer.
| other | The time stamp to compare. |
Definition at line 145 of file timepointbase.hpp.
|
inline |
Sets this object's value to the given duration, in the case the given is shorter.
| other | The time stamp to compare. |
Definition at line 136 of file timepointbase.hpp.