Timespan
Timespan
#include <icy/datetime.h>A class that represents time spans up to microsecond resolution.
Public Methods
| Return | Name | Description |
|---|---|---|
Timespan | Creates a zero Timespan. | |
Timespan | Creates a Timespan. | |
Timespan | Creates a Timespan. Useful for creating a Timespan from a struct timeval. | |
Timespan | Creates a Timespan. | |
Timespan | Creates a Timespan from another one. | |
~Timespan | Destroys the Timespan. | |
Timespan & | operator= | Assignment operator. |
Timespan & | operator= | Assignment operator. |
Timespan & | assign | Assigns a new span. |
Timespan & | assign | Assigns a new span. Useful for assigning from a struct timeval. |
void | swap | Swaps the Timespan with another one. |
bool | operator== const inline | |
bool | operator!= const inline | |
bool | operator> const inline | |
bool | operator>= const inline | |
bool | operator< const inline | |
bool | operator<= const inline | |
bool | operator== const inline | |
bool | operator!= const inline | |
bool | operator> const inline | |
bool | operator>= const inline | |
bool | operator< const inline | |
bool | operator<= const inline | |
Timespan | operator+ const | |
Timespan | operator- const | |
Timespan & | operator+= | |
Timespan & | operator-= | |
Timespan | operator+ const | |
Timespan | operator- const | |
Timespan & | operator+= | |
Timespan & | operator-= | |
int | days const inline | Returns the number of days. |
int | hours const inline | Returns the number of hours (0 to 23). |
int | totalHours const inline | Returns the total number of hours. |
int | minutes const inline | Returns the number of minutes (0 to 59). |
int | totalMinutes const inline | Returns the total number of minutes. |
int | seconds const inline | Returns the number of seconds (0 to 59). |
int | totalSeconds const inline | Returns the total number of seconds. |
int | milliseconds const inline | Returns the number of milliseconds (0 to 999). |
TimeDiff | totalMilliseconds const inline | Returns the total number of milliseconds. |
int | microseconds const inline | Returns the fractions of a millisecond in microseconds (0 to 999). |
int | useconds const inline | Returns the fractions of a second in microseconds (0 to 999999). |
TimeDiff | totalMicroseconds const inline | Returns the total number of microseconds. |
Timespan
Timespan()Creates a zero Timespan.
Timespan
Timespan(TimeDiff microseconds)Creates a Timespan.
Timespan
Timespan(long seconds, long microseconds)Creates a Timespan. Useful for creating a Timespan from a struct timeval.
Timespan
Timespan(int days, int hours, int minutes, int seconds, int microseconds)Creates a Timespan.
Timespan
Timespan(const Timespan & timespan)Creates a Timespan from another one.
~Timespan
~Timespan()Destroys the Timespan.
operator=
Timespan & operator=(const Timespan & timespan)Assignment operator.
operator=
Timespan & operator=(TimeDiff microseconds)Assignment operator.
assign
Timespan & assign(int days, int hours, int minutes, int seconds, int microseconds)Assigns a new span.
assign
Timespan & assign(long seconds, long microseconds)Assigns a new span. Useful for assigning from a struct timeval.
swap
void swap(Timespan & timespan)Swaps the Timespan with another one.
operator==
const inline
inline bool operator==(const Timespan & ts) constoperator!=
const inline
inline bool operator!=(const Timespan & ts) constoperator>
const inline
inline bool operator>(const Timespan & ts) constoperator>=
const inline
inline bool operator>=(const Timespan & ts) constoperator<
const inline
inline bool operator<(const Timespan & ts) constoperator<=
const inline
inline bool operator<=(const Timespan & ts) constoperator==
const inline
inline bool operator==(TimeDiff microseconds) constoperator!=
const inline
inline bool operator!=(TimeDiff microseconds) constoperator>
const inline
inline bool operator>(TimeDiff microseconds) constoperator>=
const inline
inline bool operator>=(TimeDiff microseconds) constoperator<
const inline
inline bool operator<(TimeDiff microseconds) constoperator<=
const inline
inline bool operator<=(TimeDiff microseconds) constoperator+
const
Timespan operator+(const Timespan & d) constoperator-
const
Timespan operator-(const Timespan & d) constoperator+=
Timespan & operator+=(const Timespan & d)operator-=
Timespan & operator-=(const Timespan & d)operator+
const
Timespan operator+(TimeDiff microseconds) constoperator-
const
Timespan operator-(TimeDiff microseconds) constoperator+=
Timespan & operator+=(TimeDiff microseconds)operator-=
Timespan & operator-=(TimeDiff microseconds)days
const inline
inline int days() constReturns the number of days.
hours
const inline
inline int hours() constReturns the number of hours (0 to 23).
totalHours
const inline
inline int totalHours() constReturns the total number of hours.
minutes
const inline
inline int minutes() constReturns the number of minutes (0 to 59).
totalMinutes
const inline
inline int totalMinutes() constReturns the total number of minutes.
seconds
const inline
inline int seconds() constReturns the number of seconds (0 to 59).
totalSeconds
const inline
inline int totalSeconds() constReturns the total number of seconds.
milliseconds
const inline
inline int milliseconds() constReturns the number of milliseconds (0 to 999).
totalMilliseconds
const inline
inline TimeDiff totalMilliseconds() constReturns the total number of milliseconds.
microseconds
const inline
inline int microseconds() constReturns the fractions of a millisecond in microseconds (0 to 999).
useconds
const inline
inline int useconds() constReturns the fractions of a second in microseconds (0 to 999999).
totalMicroseconds
const inline
inline TimeDiff totalMicroseconds() constReturns the total number of microseconds.
Public Static Attributes
| Return | Name | Description |
|---|---|---|
const TimeDiff | MILLISECONDS static | The number of microseconds in a millisecond. |
const TimeDiff | SECONDS static | The number of microseconds in a second. |
const TimeDiff | MINUTES static | The number of microseconds in a minute. |
const TimeDiff | HOURS static | The number of microseconds in a hour. |
const TimeDiff | DAYS static | The number of microseconds in a day. |
MILLISECONDS
static
const TimeDiff MILLISECONDSThe number of microseconds in a millisecond.
SECONDS
static
const TimeDiff SECONDSThe number of microseconds in a second.
MINUTES
static
const TimeDiff MINUTESThe number of microseconds in a minute.
HOURS
static
const TimeDiff HOURSThe number of microseconds in a hour.
DAYS
static
const TimeDiff DAYSThe number of microseconds in a day.
Public Types
| Name | Description |
|---|---|
TimeDiff |
TimeDiff
Timestamp::TimeDiff TimeDiff()Private Attributes
| Return | Name | Description |
|---|---|---|
TimeDiff | _span |
_span
TimeDiff _span