Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

IDEA::Time Class Reference
[Utilities]

Internal IDEA time representation. More...

#include <TimeBasics.hh>

List of all members.

Public Methods

 Time ()
 Constructor.

 Time (long sec, long nsec)
 Constructor.

 Time (const timespec &t)
 Construct the Time object from a timespec.

 Time (const Time &t)
void set (long sec, long nsec)
 Initializes the Time from two longs.

void set (double d)
 Initializes the Time from a double, which is assumed to be in second format, with any remainder treated as nanoseconds.

void set (const timespec &t)
 Initializes the Time object from a timespec.

 operator timespec () const
 Returns the value of the object as a timespec.

long getSeconds () const
 Get seconds.

void setSeconds (long sec)
 Set seconds.

long getNanoSeconds () const
 Get nano-seconds.

void setNanoSeconds (long nsec)
 Set nanoseconds.

Time & operator+= (const Time &tv)
 Add tv to this.

Time & operator-= (const Time &tv)
 Subtract tv from this.

Time & operator *= (double d)
 Multiply the time value by the d factor, which must be >= 0.

Time & operator++ (void)
 Increment microseconds as prefix.

Time & operator-- (void)
 Decrement nano-seconds as prefix.


Static Public Methods

const Time & getZero ()
 Returns the representation of zero in type Time.

const Time & getSecond ()
 Returns the representation of one second in type Time.

const Time & getMinute ()
 Returns the representation of one minute in type Time.

const Time & getHour ()
 Returns the representation of one hour in type Time.

const Time & getDay ()
 Returns the representation of one day in type Time.

const Time & getWeek ()
 Returns the representation of one week in type Time.

const Time & getYear ()
 Returns the representation of one year in type Time.

Time convert (int units, const Granularity &g)
 Creates an instance of Time of units of time assuming the units are expressed in time unit g.

int convert (const Time &t, const Granularity &g)

Private Methods

void normalize ()
 Normalizes the invoking Time instance.


Private Attributes

timespec m_TimeImpl

Static Private Attributes

const Time s_Zero = Time( 0, 0)
const Time s_Second = Time( 1, 0)
const Time s_Minute = Time( 60, 0)
const Time s_Hour = Time( 3600, 0)
const Time s_Day = Time( 86400, 0)
const Time s_Week = Time( 604800, 0)
const Time s_Month
const Time s_Year = Time( 31449600, 0)

Friends

Time operator+ (const Time &tv1, const Time &tv2)
 Adds two Time objects together, returns the sum.

Time operator- (const Time &tv1, const Time &tv2)
 Subtracts two ACE_Time_Value objects, returns the difference.

bool operator< (const Time &tv1, const Time &tv2)
 True if tv1 < tv2.

bool operator> (const Time &tv1, const Time &tv2)
 True if tv1 > tv2.

bool operator<= (const Time &tv1, const Time &tv2)
 True if tv1 <= tv2.

bool operator>= (const Time &tv1, const Time &tv2)
 True if tv1 >= tv2.

bool operator== (const Time &tv1, const Time &tv2)
 True if tv1 == tv2.

bool operator!= (const Time &tv1, const Time &tv2)
 True if tv1 != tv2.

Time operator * (double d, const Time &tv)
 Multiplies the time value by d.

Time operator * (const Time &tv, double d)
 Multiplies the time value by d.

std::ostream & operator<< (std::ostream &os, const Time &t)


Detailed Description

Internal IDEA time representation.


Constructor & Destructor Documentation

IDEA::Time::Time  
 

Constructor.

IDEA::Time::Time long    sec,
long    nsec
 

Constructor.

IDEA::Time::Time const timespec &    t
 

Construct the Time object from a timespec.

IDEA::Time::Time const Time &    t
 


Member Function Documentation

int IDEA::Time::convert const Time &    t,
const Granularity   g
[static]
 

Time IDEA::Time::convert int    units,
const Granularity   g
[static]
 

Creates an instance of Time of units of time assuming the units are expressed in time unit g.

const Time & IDEA::Time::getDay   [static]
 

Returns the representation of one day in type Time.

const Time & IDEA::Time::getHour   [static]
 

Returns the representation of one hour in type Time.

const Time & IDEA::Time::getMinute   [static]
 

Returns the representation of one minute in type Time.

long IDEA::Time::getNanoSeconds  
 

Get nano-seconds.

const Time & IDEA::Time::getSecond   [static]
 

Returns the representation of one second in type Time.

long IDEA::Time::getSeconds  
 

Get seconds.

const Time & IDEA::Time::getWeek   [static]
 

Returns the representation of one week in type Time.

const Time & IDEA::Time::getYear   [static]
 

Returns the representation of one year in type Time.

const Time & IDEA::Time::getZero   [static]
 

Returns the representation of zero in type Time.

void IDEA::Time::normalize   [private]
 

Normalizes the invoking Time instance.

Puts it in canonical form, that is if there are more nano-seconds stored in the nano-seconds field than there are nano-seconds in a second we increment the number of seconds and decrement the number of nano-seconds appropratly.

Time & IDEA::Time::operator *= double    d
 

Multiply the time value by the d factor, which must be >= 0.

IDEA::Time::operator timespec  
 

Returns the value of the object as a timespec.

Time & IDEA::Time::operator++ void   
 

Increment microseconds as prefix.

Time & IDEA::Time::operator+= const Time &    tv
 

Add tv to this.

Time & IDEA::Time::operator-- void   
 

Decrement nano-seconds as prefix.

Time & IDEA::Time::operator-= const Time &    tv
 

Subtract tv from this.

void IDEA::Time::set const timespec &    t
 

Initializes the Time object from a timespec.

void IDEA::Time::set double    d
 

Initializes the Time from a double, which is assumed to be in second format, with any remainder treated as nanoseconds.

void IDEA::Time::set long    sec,
long    nsec
 

Initializes the Time from two longs.

void IDEA::Time::setNanoSeconds long    nsec
 

Set nanoseconds.

void IDEA::Time::setSeconds long    sec
 

Set seconds.


Friends And Related Function Documentation

Time operator * const Time &    tv,
double    d
[friend]
 

Multiplies the time value by d.

Time operator * double    d,
const Time &    tv
[friend]
 

Multiplies the time value by d.

bool operator!= const Time &    tv1,
const Time &    tv2
[friend]
 

True if tv1 != tv2.

Time operator+ const Time &    tv1,
const Time &    tv2
[friend]
 

Adds two Time objects together, returns the sum.

Time operator- const Time &    tv1,
const Time &    tv2
[friend]
 

Subtracts two ACE_Time_Value objects, returns the difference.

bool operator< const Time &    tv1,
const Time &    tv2
[friend]
 

True if tv1 < tv2.

std::ostream& operator<< std::ostream &    os,
const Time &    t
[friend]
 

bool operator<= const Time &    tv1,
const Time &    tv2
[friend]
 

True if tv1 <= tv2.

bool operator== const Time &    tv1,
const Time &    tv2
[friend]
 

True if tv1 == tv2.

bool operator> const Time &    tv1,
const Time &    tv2
[friend]
 

True if tv1 > tv2.

bool operator>= const Time &    tv1,
const Time &    tv2
[friend]
 

True if tv1 >= tv2.


Member Data Documentation

timespec IDEA::Time::m_TimeImpl [private]
 

const Time IDEA::Time::s_Day = Time( 86400, 0) [static, private]
 

const Time IDEA::Time::s_Hour = Time( 3600, 0) [static, private]
 

const Time IDEA::Time::s_Minute = Time( 60, 0) [static, private]
 

const Time IDEA::Time::s_Month [static, private]
 

const Time IDEA::Time::s_Second = Time( 1, 0) [static, private]
 

const Time IDEA::Time::s_Week = Time( 604800, 0) [static, private]
 

const Time IDEA::Time::s_Year = Time( 31449600, 0) [static, private]
 

const Time IDEA::Time::s_Zero = Time( 0, 0) [static, private]
 


Contact information
© IDEA
Generated on Fri Feb 3 17:09:49 2006 for IDEA.