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

Protected Attributes

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

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

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.
te::dt::TimeDuration::TimeDuration ( boost::posix_time::time_duration &  t)

Constructor.

Parameters
tA time duration.
virtual te::dt::TimeDuration::~TimeDuration ( )
virtual

Destructor.

Member Function Documentation

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

It returns a clone of this object.

Returns
A clone of this object.

Implements te::dt::AbstractData.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.
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.

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.

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.

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

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

The internal time duration information.

Definition at line 189 of file TimeDuration.h.


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