Loading...
Searching...
No Matches
te::dt::TimeDuration Class Reference

A class to represent time duration with nano-second/micro-second resolution. More...

#include <TimeDuration.h>

Inheritance diagram for te::dt::TimeDuration:
te::dt::DateTime te::dt::AbstractData

Public Member Functions

AbstractDataclone () const
 It returns a clone of this object.
 
DateTimeType getDateTimeType () const
 It returns the subtype of the date and time type.
 
boost::int64_t getFractionalSeconds () const
 It returns the fractional seconds.
 
long getHours () const
 It returns the hours of a day - from 0 to 23.
 
long getMinutes () const
 It returns the minutes of a hour - from 0 to 59.
 
long getSeconds () const
 It returns the seconds of a minute - from 0 to 59.
 
boost::posix_time::time_duration & getTimeDuration ()
 It returns the boost time duration type.
 
const boost::posix_time::time_duration & getTimeDuration () const
 It returns the boost time duration type.
 
int getTypeCode () const
 It returns the data type code associated to date and time values: DATETIME_TYPE.
 
bool operator!= (const DateTime &rhs) const
 Operator !=.
 
long operator- (const TimeDuration &rhs) const
 Operator -.
 
bool operator< (const DateTime &rhs) const
 Operator <.
 
bool operator== (const DateTime &rhs) const
 Operator ==.
 
bool operator> (const DateTime &rhs) const
 Operator <.
 
 TimeDuration (boost::posix_time::time_duration &t)
 Constructor.
 
 TimeDuration (long hours, long minutes, long seconds, boost::int64_t fracSeconds=0)
 Constructor.
 
std::string toString () const
 It returns the time duration in the ISO textual format (hh:mm:ss,ss).
 
virtual ~TimeDuration ()
 Destructor.
 

Protected Attributes

boost::posix_time::time_duration m_timeDuration
 The internal time duration information.
 

Detailed Description

A class to represent time duration with nano-second/micro-second resolution.

A class to represent time duration with nano-second/micro-second resolution (hh:mm:ss,ss). Internally, it uses the datetime boost library to represent time duration, by using the data type boost::posix_time::time_duration.

See also
DateTime, Date, DatePeriod, DateDuration, TimeInstant, TimeInstantTZ, TimePeriod, TimePeriodTZ

Definition at line 51 of file TimeDuration.h.

Constructor & Destructor Documentation

◆ TimeDuration() [1/2]

te::dt::TimeDuration::TimeDuration ( long hours,
long minutes,
long seconds,
boost::int64_t fracSeconds = 0 )

Constructor.

Parameters
hoursA number of hours of a day - from 0 to 23.
minutesA number of minutes of a hour - from 0 to 59.
secondsA number of seconds of a minute - from 0 to 59.
fracSecondsA fractional seconds.

Referenced by operator-().

◆ TimeDuration() [2/2]

te::dt::TimeDuration::TimeDuration ( boost::posix_time::time_duration & t)

Constructor.

Parameters
tA time duration.

◆ ~TimeDuration()

virtual te::dt::TimeDuration::~TimeDuration ( )
virtual

Destructor.

Member Function Documentation

◆ clone()

AbstractData * te::dt::TimeDuration::clone ( ) const
virtual

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

◆ getDateTimeType()

DateTimeType te::dt::TimeDuration::getDateTimeType ( ) const
inlinevirtual

It returns the subtype of the date and time type.

Returns
The subtype of the date and time type.

Implements te::dt::DateTime.

Definition at line 180 of file TimeDuration.h.

References te::dt::TIME_DURATION.

◆ getFractionalSeconds()

boost::int64_t te::dt::TimeDuration::getFractionalSeconds ( ) const
inline

It returns the fractional seconds.

Returns
The the fractional seconds

Definition at line 112 of file TimeDuration.h.

References m_timeDuration.

◆ getHours()

long te::dt::TimeDuration::getHours ( ) const
inline

It returns the hours of a day - from 0 to 23.

Returns
The hour of a day.

Definition at line 91 of file TimeDuration.h.

References m_timeDuration.

◆ getMinutes()

long te::dt::TimeDuration::getMinutes ( ) const
inline

It returns the minutes of a hour - from 0 to 59.

Returns
The the minutes of a hour.

Definition at line 98 of file TimeDuration.h.

References m_timeDuration.

◆ getSeconds()

long te::dt::TimeDuration::getSeconds ( ) const
inline

It returns the seconds of a minute - from 0 to 59.

Returns
The the seconds of a minute.

Definition at line 105 of file TimeDuration.h.

References m_timeDuration.

◆ getTimeDuration() [1/2]

boost::posix_time::time_duration & te::dt::TimeDuration::getTimeDuration ( )
inline

It returns the boost time duration type.

Returns
The boost time duration type.

Definition at line 84 of file TimeDuration.h.

References m_timeDuration.

◆ getTimeDuration() [2/2]

const boost::posix_time::time_duration & te::dt::TimeDuration::getTimeDuration ( ) const
inline

It returns the boost time duration type.

Returns
The boost time duration type.

Definition at line 77 of file TimeDuration.h.

References m_timeDuration.

◆ getTypeCode()

int te::dt::DateTime::getTypeCode ( ) const
inlinevirtualinherited

It returns the data type code associated to date and time values: DATETIME_TYPE.

Returns
The data type code associated to the date and time values: DATETIME_TYPE.

Implements te::dt::AbstractData.

Definition at line 103 of file DateTime.h.

References te::dt::DATETIME_TYPE.

◆ operator!=()

bool te::dt::TimeDuration::operator!= ( const DateTime & rhs) const
virtual

Operator !=.

Parameters
rhsThe time duration to be compared.
Returns
It returns true if the two time durations are not equal. Otherwise, it returns false.

Implements te::dt::DateTime.

References te::dt::DateTime::DateTime().

◆ operator-()

long te::dt::TimeDuration::operator- ( const TimeDuration & rhs) const

Operator -.

Parameters
rhsThe right-hand-side time instant.
Returns
It returns the number of seconds between the two time durations.

References TimeDuration().

◆ operator<()

bool te::dt::TimeDuration::operator< ( const DateTime & rhs) const
virtual

Operator <.

Parameters
rhsThe right-hand-side time duration to be compared.
Returns
It returns true if the right-hand-side time duration is greater than the lefth side one. Otherwise, it returns false.

Implements te::dt::DateTime.

References te::dt::DateTime::DateTime().

◆ operator==()

bool te::dt::TimeDuration::operator== ( const DateTime & rhs) const
virtual

Operator ==.

Parameters
rhsThe time duration to be compared.
Returns
It returns true if the two time durations are equal. Otherwise, it returns false.

Implements te::dt::DateTime.

References te::dt::DateTime::DateTime().

◆ operator>()

bool te::dt::TimeDuration::operator> ( const DateTime & rhs) const
virtual

Operator <.

Parameters
rhsThe right-hand-side time duration to be compared.
Returns
It returns true if the right-hand-side time duration is less than the lefth side one. Otherwise, it returns false.

Implements te::dt::DateTime.

References te::dt::DateTime::DateTime().

◆ toString()

std::string te::dt::TimeDuration::toString ( ) const
virtual

It returns the time duration in the ISO textual format (hh:mm:ss,ss).

Returns
The date in the ISO textual format (hh:mm:ss,ss).

Implements te::dt::AbstractData.

Member Data Documentation

◆ m_timeDuration

boost::posix_time::time_duration te::dt::TimeDuration::m_timeDuration
protected

The internal time duration information.

Definition at line 189 of file TimeDuration.h.

Referenced by getFractionalSeconds(), getHours(), getMinutes(), getSeconds(), getTimeDuration(), and getTimeDuration().


The documentation for this class was generated from the following file: