CppCommon
1.0.4.1
C++ Common Library
|
#include <timespan.h>
Public Member Functions | |
Timespan () noexcept | |
Initialize timespan with a zero time duration. More... | |
Timespan (int64_t duration) noexcept | |
Initialize timespan with a given time duration value in nanoseconds. More... | |
template<class Rep , class Period > | |
Timespan (const std::chrono::duration< Rep, Period > &duration) noexcept | |
Initialize timespan with a given std::chrono duration. More... | |
Timespan (const Timespan &) noexcept=default | |
Timespan (Timespan &&) noexcept=default | |
~Timespan () noexcept=default | |
Timespan & | operator= (int64_t duration) noexcept |
Timespan & | operator= (const Timespan &) noexcept=default |
Timespan & | operator= (Timespan &&) noexcept=default |
Timespan | operator+ () const |
Timespan | operator- () const |
Timespan & | operator+= (int64_t offset) noexcept |
Timespan & | operator+= (const Timespan &offset) noexcept |
Timespan & | operator-= (int64_t offset) noexcept |
Timespan & | operator-= (const Timespan &offset) noexcept |
std::chrono::system_clock::duration | chrono () const noexcept |
Convert timespan to the std::chrono nanoseconds duration. More... | |
int64_t | days () const noexcept |
Get total days of the current timespan. More... | |
int64_t | hours () const noexcept |
Get total hours of the current timespan. More... | |
int64_t | minutes () const noexcept |
Get total minutes of the current timespan. More... | |
int64_t | seconds () const noexcept |
Get total seconds of the current timespan. More... | |
int64_t | milliseconds () const noexcept |
Get total milliseconds of the current timespan. More... | |
int64_t | microseconds () const noexcept |
Get total microseconds of the current timespan. More... | |
int64_t | nanoseconds () const noexcept |
Get total nanoseconds of the current timespan. More... | |
int64_t | total () const noexcept |
Get total value of the current timespan (total nanoseconds) More... | |
void | swap (Timespan ×pan) noexcept |
Swap two instances. More... | |
Static Public Member Functions | |
static Timespan | days (int64_t days) noexcept |
Create the timespan based on the given days value. More... | |
static Timespan | hours (int64_t hours) noexcept |
Create the timespan based on the given hours value. More... | |
static Timespan | minutes (int64_t minutes) noexcept |
Create the timespan based on the given minutes value. More... | |
static Timespan | seconds (int64_t seconds) noexcept |
Create the timespan based on the given seconds value. More... | |
static Timespan | milliseconds (int64_t milliseconds) noexcept |
Create the timespan based on the given milliseconds value. More... | |
static Timespan | microseconds (int64_t microseconds) noexcept |
Create the timespan based on the given microseconds value. More... | |
static Timespan | nanoseconds (int64_t nanoseconds) noexcept |
Create the timespan based on the given nanoseconds value. More... | |
static Timespan | zero () noexcept |
Get zero timespan. More... | |
Friends | |
Timespan | operator+ (const Timespan ×pan, int64_t offset) noexcept |
Timespan | operator+ (int64_t offset, const Timespan ×pan) noexcept |
Timespan | operator+ (const Timespan ×pan1, const Timespan ×pan2) noexcept |
Timespan | operator- (const Timespan ×pan, int64_t offset) noexcept |
Timespan | operator- (int64_t offset, const Timespan ×pan) noexcept |
Timespan | operator- (const Timespan ×pan1, const Timespan ×pan2) noexcept |
bool | operator== (const Timespan ×pan, int64_t offset) noexcept |
bool | operator== (int64_t offset, const Timespan ×pan) noexcept |
bool | operator== (const Timespan ×pan1, const Timespan ×pan2) noexcept |
bool | operator!= (const Timespan ×pan, int64_t offset) noexcept |
bool | operator!= (int64_t offset, const Timespan ×pan) noexcept |
bool | operator!= (const Timespan ×pan1, const Timespan ×pan2) noexcept |
bool | operator> (const Timespan ×pan, int64_t offset) noexcept |
bool | operator> (int64_t offset, const Timespan ×pan) noexcept |
bool | operator> (const Timespan ×pan1, const Timespan ×pan2) noexcept |
bool | operator< (const Timespan ×pan, int64_t offset) noexcept |
bool | operator< (int64_t offset, const Timespan ×pan) noexcept |
bool | operator< (const Timespan ×pan1, const Timespan ×pan2) noexcept |
bool | operator>= (const Timespan ×pan, int64_t offset) noexcept |
bool | operator>= (int64_t offset, const Timespan ×pan) noexcept |
bool | operator>= (const Timespan ×pan1, const Timespan ×pan2) noexcept |
bool | operator<= (const Timespan ×pan, int64_t offset) noexcept |
bool | operator<= (int64_t offset, const Timespan ×pan) noexcept |
bool | operator<= (const Timespan ×pan1, const Timespan ×pan2) noexcept |
void | swap (Timespan ×pan1, Timespan ×pan2) noexcept |
Timespan wraps time duration in nanoseconds or difference between two timestamps and allows to get separate values of days, hours, minutes, seconds, milliseconds, microseconds or nanoseconds.
Not thread-safe.
Definition at line 26 of file timespan.h.
|
inlinenoexcept |
Initialize timespan with a zero time duration.
Definition at line 30 of file timespan.h.
|
inlineexplicitnoexcept |
Initialize timespan with a given time duration value in nanoseconds.
duration | - Time duration value in nanoseconds |
Definition at line 35 of file timespan.h.
|
inlineexplicitnoexcept |
Initialize timespan with a given std::chrono duration.
duration | - std::chrono duration |
Definition at line 41 of file timespan.h.
|
defaultnoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
|
inlinenoexcept |
Convert timespan to the std::chrono nanoseconds duration.
Definition at line 125 of file timespan.h.
|
inlinenoexcept |
Get total days of the current timespan.
Definition at line 129 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given days value.
Definition at line 155 of file timespan.h.
|
inlinenoexcept |
Get total hours of the current timespan.
Definition at line 132 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given hours value.
Definition at line 158 of file timespan.h.
|
inlinenoexcept |
Get total microseconds of the current timespan.
Definition at line 144 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given microseconds value.
Definition at line 170 of file timespan.h.
|
inlinenoexcept |
Get total milliseconds of the current timespan.
Definition at line 141 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given milliseconds value.
Definition at line 167 of file timespan.h.
|
inlinenoexcept |
Get total minutes of the current timespan.
Definition at line 135 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given minutes value.
Definition at line 161 of file timespan.h.
|
inlinenoexcept |
Get total nanoseconds of the current timespan.
Definition at line 147 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given nanoseconds value.
Definition at line 173 of file timespan.h.
|
inline |
Definition at line 52 of file timespan.h.
Definition at line 59 of file timespan.h.
|
inlinenoexcept |
Definition at line 57 of file timespan.h.
|
inline |
Definition at line 54 of file timespan.h.
Definition at line 64 of file timespan.h.
|
inlinenoexcept |
Definition at line 62 of file timespan.h.
|
inlinenoexcept |
Definition at line 46 of file timespan.h.
|
inlinenoexcept |
Get total seconds of the current timespan.
Definition at line 138 of file timespan.h.
|
inlinestaticnoexcept |
Create the timespan based on the given seconds value.
Definition at line 164 of file timespan.h.
|
inlinenoexcept |
Swap two instances.
Definition at line 11 of file timespan.inl.
|
inlinenoexcept |
Get total value of the current timespan (total nanoseconds)
Definition at line 151 of file timespan.h.
|
inlinestaticnoexcept |
|
friend |
Definition at line 89 of file timespan.h.
Definition at line 93 of file timespan.h.
|
friend |
Definition at line 91 of file timespan.h.
Definition at line 67 of file timespan.h.
Definition at line 71 of file timespan.h.
Definition at line 69 of file timespan.h.
Definition at line 74 of file timespan.h.
Definition at line 78 of file timespan.h.
Definition at line 76 of file timespan.h.
|
friend |
Definition at line 103 of file timespan.h.
Definition at line 107 of file timespan.h.
|
friend |
Definition at line 105 of file timespan.h.
|
friend |
Definition at line 117 of file timespan.h.
Definition at line 121 of file timespan.h.
|
friend |
Definition at line 119 of file timespan.h.
|
friend |
Definition at line 82 of file timespan.h.
Definition at line 86 of file timespan.h.
|
friend |
Definition at line 84 of file timespan.h.
|
friend |
Definition at line 96 of file timespan.h.
Definition at line 100 of file timespan.h.
|
friend |
Definition at line 98 of file timespan.h.
|
friend |
Definition at line 110 of file timespan.h.
Definition at line 114 of file timespan.h.
|
friend |
Definition at line 112 of file timespan.h.
Definition at line 17 of file timespan.inl.