Base module

Timespan

A class that represents time spans up to microsecond resolution.

Timespan

#include <icy/datetime.h>

A class that represents time spans up to microsecond resolution.

Public Methods

ReturnNameDescription
TimespanCreates a zero Timespan.
TimespanCreates a Timespan.
TimespanCreates a Timespan. Useful for creating a Timespan from a struct timeval.
TimespanCreates a Timespan.
TimespanCreates a Timespan from another one.
~TimespanDestroys the Timespan.
Timespan &operator=Assignment operator.
Timespan &operator=Assignment operator.
Timespan &assignAssigns a new span.
Timespan &assignAssigns a new span. Useful for assigning from a struct timeval.
voidswapSwaps the Timespan with another one.
booloperator== const inline
booloperator!= const inline
booloperator> const inline
booloperator>= const inline
booloperator< const inline
booloperator<= const inline
booloperator== const inline
booloperator!= const inline
booloperator> const inline
booloperator>= const inline
booloperator< const inline
booloperator<= const inline
Timespanoperator+ const
Timespanoperator- const
Timespan &operator+=
Timespan &operator-=
Timespanoperator+ const
Timespanoperator- const
Timespan &operator+=
Timespan &operator-=
intdays const inlineReturns the number of days.
inthours const inlineReturns the number of hours (0 to 23).
inttotalHours const inlineReturns the total number of hours.
intminutes const inlineReturns the number of minutes (0 to 59).
inttotalMinutes const inlineReturns the total number of minutes.
intseconds const inlineReturns the number of seconds (0 to 59).
inttotalSeconds const inlineReturns the total number of seconds.
intmilliseconds const inlineReturns the number of milliseconds (0 to 999).
TimeDifftotalMilliseconds const inlineReturns the total number of milliseconds.
intmicroseconds const inlineReturns the fractions of a millisecond in microseconds (0 to 999).
intuseconds const inlineReturns the fractions of a second in microseconds (0 to 999999).
TimeDifftotalMicroseconds const inlineReturns 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) const

operator!=

const inline

inline bool operator!=(const Timespan & ts) const

operator>

const inline

inline bool operator>(const Timespan & ts) const

operator>=

const inline

inline bool operator>=(const Timespan & ts) const

operator<

const inline

inline bool operator<(const Timespan & ts) const

operator<=

const inline

inline bool operator<=(const Timespan & ts) const

operator==

const inline

inline bool operator==(TimeDiff microseconds) const

operator!=

const inline

inline bool operator!=(TimeDiff microseconds) const

operator>

const inline

inline bool operator>(TimeDiff microseconds) const

operator>=

const inline

inline bool operator>=(TimeDiff microseconds) const

operator<

const inline

inline bool operator<(TimeDiff microseconds) const

operator<=

const inline

inline bool operator<=(TimeDiff microseconds) const

operator+

const

Timespan operator+(const Timespan & d) const

operator-

const

Timespan operator-(const Timespan & d) const

operator+=

Timespan & operator+=(const Timespan & d)

operator-=

Timespan & operator-=(const Timespan & d)

operator+

const

Timespan operator+(TimeDiff microseconds) const

operator-

const

Timespan operator-(TimeDiff microseconds) const

operator+=

Timespan & operator+=(TimeDiff microseconds)

operator-=

Timespan & operator-=(TimeDiff microseconds)

days

const inline

inline int days() const

Returns the number of days.


hours

const inline

inline int hours() const

Returns the number of hours (0 to 23).


totalHours

const inline

inline int totalHours() const

Returns the total number of hours.


minutes

const inline

inline int minutes() const

Returns the number of minutes (0 to 59).


totalMinutes

const inline

inline int totalMinutes() const

Returns the total number of minutes.


seconds

const inline

inline int seconds() const

Returns the number of seconds (0 to 59).


totalSeconds

const inline

inline int totalSeconds() const

Returns the total number of seconds.


milliseconds

const inline

inline int milliseconds() const

Returns the number of milliseconds (0 to 999).


totalMilliseconds

const inline

inline TimeDiff totalMilliseconds() const

Returns the total number of milliseconds.


microseconds

const inline

inline int microseconds() const

Returns the fractions of a millisecond in microseconds (0 to 999).


useconds

const inline

inline int useconds() const

Returns the fractions of a second in microseconds (0 to 999999).


totalMicroseconds

const inline

inline TimeDiff totalMicroseconds() const

Returns the total number of microseconds.

Public Static Attributes

ReturnNameDescription
const TimeDiffMILLISECONDS staticThe number of microseconds in a millisecond.
const TimeDiffSECONDS staticThe number of microseconds in a second.
const TimeDiffMINUTES staticThe number of microseconds in a minute.
const TimeDiffHOURS staticThe number of microseconds in a hour.
const TimeDiffDAYS staticThe number of microseconds in a day.

MILLISECONDS

static

const TimeDiff MILLISECONDS

The number of microseconds in a millisecond.


SECONDS

static

const TimeDiff SECONDS

The number of microseconds in a second.


MINUTES

static

const TimeDiff MINUTES

The number of microseconds in a minute.


HOURS

static

const TimeDiff HOURS

The number of microseconds in a hour.


DAYS

static

const TimeDiff DAYS

The number of microseconds in a day.

Public Types

NameDescription
TimeDiff

TimeDiff

Timestamp::TimeDiff TimeDiff()

Private Attributes

ReturnNameDescription
TimeDiff_span

_span

TimeDiff _span