TimeSpan Class Reference

CPP API: mio::abm::TimeSpan Class Reference
mio::abm::TimeSpan Class Reference

A duration of time. More...

#include <time.h>

Public Member Functions

ScalarType days () const
 Length of time in days. More...
 
auto default_serialize ()
 This method is used by the default serialization feature. More...
 
ScalarType hours () const
 Length of time in hours. More...
 
int seconds () const
 Length of time in seconds. More...
 
 TimeSpan ()=default
 Default ctor, uninitialized. More...
 
 TimeSpan (int seconds)
 Creates a TimeSpan that represents a number of seconds. More...
 
Comparison operators.
bool operator== (const TimeSpan &other) const
 
bool operator!= (const TimeSpan &other) const
 
bool operator< (const TimeSpan &other) const
 
bool operator<= (const TimeSpan &other) const
 
bool operator> (const TimeSpan &other) const
 
bool operator>= (const TimeSpan &other) const
 
Numeric operators for addition, subtraction, and scalar integer multiplication and division.
TimeSpan operator+ (const TimeSpan &s) const
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpanoperator+= (const TimeSpan &s)
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpan operator- (const TimeSpan &s) const
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpanoperator-= (const TimeSpan &s)
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpan operator* (int f) const
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpan multiply (double f) const
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpanoperator*= (int f)
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpan operator/ (int f) const
 Multiplication with double and rounding down afterwards to whole seconds. More...
 
TimeSpanoperator/= (int f)
 Multiplication with double and rounding down afterwards to whole seconds. More...
 

Private Attributes

int m_seconds
 The duration of time in seconds. More...
 

Detailed Description

A duration of time.

Resolution 1 second.

Constructor & Destructor Documentation

◆ TimeSpan() [1/2]

mio::abm::TimeSpan::TimeSpan ( )
default

Default ctor, uninitialized.

◆ TimeSpan() [2/2]

mio::abm::TimeSpan::TimeSpan ( int  seconds)
inlineexplicit

Creates a TimeSpan that represents a number of seconds.

Parameters
[in]secondsThe number of seconds.

Member Function Documentation

◆ days()

ScalarType mio::abm::TimeSpan::days ( ) const
inline

Length of time in days.

◆ default_serialize()

auto mio::abm::TimeSpan::default_serialize ( )
inline

This method is used by the default serialization feature.

◆ hours()

ScalarType mio::abm::TimeSpan::hours ( ) const
inline

Length of time in hours.

◆ multiply()

TimeSpan mio::abm::TimeSpan::multiply ( double  f) const
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator!=()

bool mio::abm::TimeSpan::operator!= ( const TimeSpan other) const
inline

◆ operator*()

TimeSpan mio::abm::TimeSpan::operator* ( int  f) const
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator*=()

TimeSpan& mio::abm::TimeSpan::operator*= ( int  f)
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator+()

TimeSpan mio::abm::TimeSpan::operator+ ( const TimeSpan s) const
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator+=()

TimeSpan& mio::abm::TimeSpan::operator+= ( const TimeSpan s)
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator-()

TimeSpan mio::abm::TimeSpan::operator- ( const TimeSpan s) const
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator-=()

TimeSpan& mio::abm::TimeSpan::operator-= ( const TimeSpan s)
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator/()

TimeSpan mio::abm::TimeSpan::operator/ ( int  f) const
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator/=()

TimeSpan& mio::abm::TimeSpan::operator/= ( int  f)
inline

Multiplication with double and rounding down afterwards to whole seconds.

Parameters
[in]fFactor to multiply with.
Returns
New TimeSpan after multiplication.

◆ operator<()

bool mio::abm::TimeSpan::operator< ( const TimeSpan other) const
inline

◆ operator<=()

bool mio::abm::TimeSpan::operator<= ( const TimeSpan other) const
inline

◆ operator==()

bool mio::abm::TimeSpan::operator== ( const TimeSpan other) const
inline

◆ operator>()

bool mio::abm::TimeSpan::operator> ( const TimeSpan other) const
inline

◆ operator>=()

bool mio::abm::TimeSpan::operator>= ( const TimeSpan other) const
inline

◆ seconds()

int mio::abm::TimeSpan::seconds ( ) const
inline

Length of time in seconds.

Member Data Documentation

◆ m_seconds

int mio::abm::TimeSpan::m_seconds
private

The duration of time in seconds.