Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

atoms::Time Class Reference

#include <time.hh>

List of all members.


Detailed Description

A high-precision absolute time suitable for POSIX realtime functions.

This supports values from epoch (1-Jan-1970 00:00:00Z) on at least 2038 (32-bit time_t) or much later (64-bit time_t), depending on the platform. It has nanosecond precision and supports a positive infinity time with the expected semantics.

Definition at line 31 of file time.hh.

Public Types

enum  InfinityTime { tINFINITY }

Public Member Functions

 Time (InfinityTime)
 Time (time_t seconds=0, long nanoseconds=0)
 Initializes with time since epoch (1-Jan-1970 00:00:00Z).

const Timeoperator= (InfinityTime)
void setToCurrent ()
 Sets to the current system time with best available precision.

const struct timespec * getTimespec () const
 Returns the internal representation, or NULL if infinity.


Static Public Attributes

const long NANOSECS_PER_SEC = 1000000000

Private Attributes

timespec ts

Friends

bool operator< (const Time &, const Time &)
bool operator== (const Time &, const Time &)
const Timeoperator+= (Time &, const Timespan &)
 Adds an interval to a time.


Member Enumeration Documentation

enum atoms::Time::InfinityTime
 

Enumeration values:
tINFINITY 

Definition at line 37 of file time.hh.


Constructor & Destructor Documentation

atoms::Time::Time InfinityTime   )  [inline]
 

Definition at line 39 of file time.hh.

References std::numeric_limits< Type >::max(), NANOSECS_PER_SEC, and ts.

Here is the call graph for this function:

atoms::Time::Time time_t  seconds = 0,
long  nanoseconds = 0
[inline]
 

Initializes with time since epoch (1-Jan-1970 00:00:00Z).

Precondition:
0 <= nanoseconds < 1e9

Definition at line 48 of file time.hh.

References NANOSECS_PER_SEC, and ts.


Member Function Documentation

const struct timespec* atoms::Time::getTimespec  )  const [inline]
 

Returns the internal representation, or NULL if infinity.

Used by functions which talk directly to the Unix API.

Definition at line 76 of file time.hh.

References NULL, and ts.

Referenced by atoms::Condition::wait().

const Time& atoms::Time::operator= InfinityTime   )  [inline]
 

Definition at line 54 of file time.hh.

References std::numeric_limits< Type >::max(), NANOSECS_PER_SEC, and ts.

Here is the call graph for this function:

void atoms::Time::setToCurrent  )  [inline]
 

Sets to the current system time with best available precision.

Definition at line 61 of file time.hh.

References NULL, and ts.

Referenced by atoms::TimeoutDispatcher::main(), and atoms::TimeoutDispatcher::OperationMon::OperationMon().


Friends And Related Function Documentation

const Time& operator+= Time t,
const Timespan toadd
[friend]
 

Adds an interval to a time.

If the time is infinity, it will remain so; timespans are always non-negative, so they can not change its value.

Definition at line 152 of file time.hh.

bool operator< const Time a,
const Time b
[friend]
 

Definition at line 87 of file time.hh.

bool operator== const Time a,
const Time b
[friend]
 

Definition at line 92 of file time.hh.


Member Data Documentation

const long atoms::Time::NANOSECS_PER_SEC = 1000000000 [static]
 

Definition at line 81 of file time.hh.

Referenced by operator=(), and Time().

struct timespec atoms::Time::ts [private]
 

Definition at line 84 of file time.hh.

Referenced by getTimespec(), atoms::operator+=(), atoms::operator<(), operator=(), atoms::operator==(), setToCurrent(), and Time().


The documentation for this class was generated from the following file:
Generated on Wed Jun 15 01:21:11 2005 for atoms++ by doxygen 1.3.5