|
HoverRace
2.0
|
The relative time between two timestamps. More...
#include <Duration.h>
Inheritance diagram for HoverRace::Util::Duration:Public Types | |
| using | dur_t = MR_Int64 |
Public Member Functions | |
| constexpr | Duration (OS::timestamp_t later, OS::timestamp_t earlier) noexcept |
| Constructor from two timestamps. More... | |
| constexpr | Duration (const Duration &later, const Duration &earlier) noexcept |
| Constructor from two durations. More... | |
| constexpr | Duration (dur_t duration=0) noexcept |
| Constructor. More... | |
| Duration (const std::string &s) | |
| template<class T > | |
| Duration (const T *s) | |
| constexpr | Duration (const Duration &) noexcept=default |
| constexpr | Duration (Duration &&) noexcept=default |
| template<> | |
| Duration (const char *s) | |
| std::ostream & | FmtLong (std::ostream &os) const |
| Stream out the full-length format. More... | |
| std::string | FmtLong () const |
| Convert to string using the full-length format. More... | |
| std::ostream & | FmtShort (std::ostream &os) const |
| Stream out the short format. More... | |
| std::string | FmtShort () const |
| Convert to string using the short format. More... | |
| constexpr Duration | operator- () const noexcept |
| Duration & | operator= (const Duration &) noexcept=default |
| Duration & | operator= (Duration &&) noexcept=default |
| constexpr dur_t | ToMs () const noexcept |
| Convert the duration to milliseconds. More... | |
Static Private Member Functions | |
| static dur_t | ParseDuration (const std::string &s) |
| Parse a duration from a string. More... | |
Private Attributes | |
| dur_t | duration |
Friends | |
| constexpr bool | operator< (const Duration &a, const Duration &b) noexcept |
| constexpr bool | operator< (const Duration &duration, Duration::dur_t ts) noexcept |
| constexpr bool | operator< (Duration::dur_t ts, const Duration &duration) noexcept |
| constexpr bool | operator== (const Duration &a, const Duration &b) noexcept |
| constexpr bool | operator== (const Duration &duration, Duration::dur_t ts) noexcept |
| constexpr bool | operator== (Duration::dur_t ts, const Duration &duration) noexcept |
The relative time between two timestamps.
Unlike OS::timestamp_t, this can represent negative times.
|
inlinenoexcept |
Constructor from two timestamps.
| later | The later of the two timestamps. |
| earlier | The earlier of the two timestamps. |
|
inlinenoexcept |
Constructor from two durations.
| later | The later of the two durations. |
| earlier | The earlier of the two durations. |
|
inlinenoexcept |
Constructor.
| duration | The time in milliseconds. |
|
inline |
| HoverRace::Util::Duration::Duration | ( | const T * | s | ) |
|
defaultnoexcept |
|
defaultnoexcept |
|
inline |
| std::ostream & HoverRace::Util::Duration::FmtLong | ( | std::ostream & | os | ) | const |
Stream out the full-length format.
The format is: hours:minutes:seconds.milliseconds
| os | The output stream. |
| std::string HoverRace::Util::Duration::FmtLong | ( | ) | const |
Convert to string using the full-length format.
The format is: hours:minutes:seconds.milliseconds
| std::ostream & HoverRace::Util::Duration::FmtShort | ( | std::ostream & | os | ) | const |
Stream out the short format.
The format is the same as the long format, but leading zero components are ignored.
| os | The output stream. |
| std::string HoverRace::Util::Duration::FmtShort | ( | ) | const |
Convert to string using the short format.
The format is the same as the long format, but leading zero components are ignored.
|
inlinenoexcept |
|
staticprivate |
Parse a duration from a string.
Example strings:
| s | The duration. |
| Exception | The duration could not be parsed. |
|
inlinenoexcept |
Convert the duration to milliseconds.
|
friend |
|
friend |
|
friend |
|
friend |
|
private |
1.8.11