Apache Qpid C++ API
Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation

qpid::sys::AbsTime Class Reference

Class to represent an instant in time. More...

#include <qpid/sys/Time.h>

List of all members.

Public Member Functions

 AbsTime ()
 AbsTime (const AbsTime &time0, const Duration &duration)
const TimePrivategetPrivate (void) const
bool operator== (const AbsTime &t) const
template<class S >
void serialize (S &s)

Static Public Member Functions

static AbsTime now ()
static AbsTime FarFuture ()

Friends

bool operator< (const AbsTime &a, const AbsTime &b)
bool operator> (const AbsTime &a, const AbsTime &b)
std::ostream & operator<< (std::ostream &, const AbsTime &)

Detailed Description

Class to represent an instant in time.

The time resolution is in nanosecs, and this is held with 64 bits giving a total time span from about 25 million years ago to 25 million years hence. As an aside the internal time can sensibly be negative meaning before the epoch (probably 1/1/1970 although this class doesn't care).

The AbsTime class is a value class and so you don't need to add any accessors to its internal state. If you think you want to replace its value, you need to construct a new AbsTime and assign it, viz:

AbsTime when = AbsTime::now(); ... when = AbsTime(when, 2*TIME_SEC); // Advance timer 2 secs

If for some reason you need access to the internal nanosec value you need to convert the AbsTime to a Duration and use its conversion to int64_t, viz:

AbsTime now = AbsTime::now();

int64_t ns = Duration(now);

However note that the nanosecond value that is returned here is not defined to be anything in particular and could vary from platform to platform.

There are some sensible operations that are currently missing from AbsTime, but nearly all that's needed can be done with a mixture of AbsTimes and Durations.

For example, convenience operators to add a Duration and AbsTime returning an AbsTime would fit here (although you can already perform the operation with one of the AbsTime constructors). However trying to add 2 AbsTimes doesn't make sense.

Definition at line 85 of file Time.h.


Constructor & Destructor Documentation

qpid::sys::AbsTime::AbsTime (  )  [inline]

Definition at line 91 of file Time.h.

qpid::sys::AbsTime::AbsTime ( const AbsTime time0,
const Duration duration 
)

Member Function Documentation

static AbsTime qpid::sys::AbsTime::FarFuture (  )  [static]
const TimePrivate& qpid::sys::AbsTime::getPrivate ( void   )  const [inline]

Definition at line 98 of file Time.h.

static AbsTime qpid::sys::AbsTime::now (  )  [static]

Referenced by qpid::sys::now().

bool qpid::sys::AbsTime::operator== ( const AbsTime t  )  const [inline]

Definition at line 99 of file Time.h.

template<class S >
void qpid::sys::AbsTime::serialize ( S &  s  )  [inline]

Definition at line 100 of file Time.h.


Friends And Related Function Documentation

bool operator< ( const AbsTime a,
const AbsTime b 
) [friend]
std::ostream& operator<< ( std::ostream &  ,
const AbsTime  
) [friend]
bool operator> ( const AbsTime a,
const AbsTime b 
) [friend]

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

Qpid C++ API Reference
Generated on Tue Nov 3 12:04:05 2009 for Qpid C++ Client API by doxygen 1.6.1