oasys::Time Struct Reference

#include <Time.h>

List of all members.


Detailed Description

Structure to handle time in a platform independent way.

Definition at line 27 of file Time.h.

Public Member Functions

 Time (u_int32_t sec=0, u_int32_t usec=0)
void get_time ()
 Get the time into the structure.
double in_seconds ()
 
Returns:
Time in seconds as a floating point number

u_int32_t in_microseconds ()
 
Returns:
Time in microseconds

u_int32_t in_milliseconds ()
 
Returns:
Time in milliseconds

u_int32_t elapsed_ms ()
 
Returns:
Milliseconds elapsed between this timer and the

void cleanup ()
 Cleanup the usec field wrt. sec.
Time operator+ (const Time &t) const
 Standard operators.
Time operator- (const Time &t) const
 Standard operators.
Timeoperator+= (const Time &t)
 Standard operators.
Timeoperator-= (const Time &t)
 Standard operators.
bool operator== (const Time &t) const
 Standard operators.
bool operator< (const Time &t) const
 Standard operators.
bool operator> (const Time &t) const
 Standard operators.
bool operator>= (const Time &t) const
 Standard operators.
bool operator<= (const Time &t) const
 Standard operators.

Public Attributes

u_int32_t sec_
u_int32_t usec_


Constructor & Destructor Documentation

oasys::Time::Time ( u_int32_t  sec = 0,
u_int32_t  usec = 0 
) [inline]

Definition at line 31 of file Time.h.

References cleanup().

Referenced by operator+().


Member Function Documentation

void oasys::Time::get_time (  ) 

Get the time into the structure.

Definition at line 34 of file Time.cc.

References cleanup(), dtnsim::gettimeofday(), sec_, and usec_.

Referenced by elapsed_ms(), oasys::TokenBucket::empty(), dtn::ProphetAckList::expire(), dtn::ProphetEncounter::handle_bad_protocol(), dtn::ProphetEncounter::handle_poll_timeout(), dtn::ProphetEncounter::handle_prophet_tlv(), dtn::ProphetEncounter::ProphetEncounter(), dtn::ProphetNode::ProphetNode(), dtntunnel::TCPTunnel::Connection::run(), dtn::ProphetEncounter::run(), dtn::BundleDaemon::run(), dtn::ProphetEncounter::send_prophet_tlv(), dtn::ProphetNode::set_age_now(), oasys::TokenBucket::TokenBucket(), oasys::TokenBucket::update(), and dtn::ProphetNode::update_age().

double oasys::Time::in_seconds (  ) 

Returns:
Time in seconds as a floating point number

Definition at line 75 of file Time.cc.

References sec_, and usec_.

u_int32_t oasys::Time::in_microseconds (  ) 

Returns:
Time in microseconds

Definition at line 83 of file Time.cc.

References sec_, and usec_.

u_int32_t oasys::Time::in_milliseconds (  ) 

Returns:
Time in milliseconds

Definition at line 90 of file Time.cc.

References sec_, and usec_.

Referenced by elapsed_ms().

u_int32_t oasys::Time::elapsed_ms (  ) 

Returns:
Milliseconds elapsed between this timer and the

Definition at line 97 of file Time.cc.

References get_time(), and in_milliseconds().

Referenced by dtn::BundleDaemon::run().

Time oasys::Time::operator+ ( const Time t  )  const

Standard operators.

Definition at line 107 of file Time.cc.

References sec_, Time(), and usec_.

Time oasys::Time::operator- ( const Time t  )  const

Standard operators.

Definition at line 139 of file Time.cc.

Time & oasys::Time::operator+= ( const Time t  ) 

Standard operators.

Definition at line 114 of file Time.cc.

References cleanup(), sec_, and usec_.

Time & oasys::Time::operator-= ( const Time t  ) 

Standard operators.

Definition at line 124 of file Time.cc.

References sec_, and usec_.

bool oasys::Time::operator== ( const Time t  )  const

Standard operators.

Definition at line 149 of file Time.cc.

References sec_, and usec_.

bool oasys::Time::operator< ( const Time t  )  const

Standard operators.

Definition at line 156 of file Time.cc.

References sec_, and usec_.

bool oasys::Time::operator> ( const Time t  )  const

Standard operators.

Definition at line 164 of file Time.cc.

References sec_, and usec_.

bool oasys::Time::operator>= ( const Time t  )  const

Standard operators.

Definition at line 179 of file Time.cc.

bool oasys::Time::operator<= ( const Time t  )  const

Standard operators.

Definition at line 172 of file Time.cc.

void oasys::Time::cleanup (  ) 

Cleanup the usec field wrt. sec.

Definition at line 186 of file Time.cc.

References sec_, and usec_.

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


Member Data Documentation

u_int32_t oasys::Time::sec_

Definition at line 28 of file Time.h.

Referenced by cleanup(), dtn::ProphetAckList::expire(), get_time(), in_microseconds(), in_milliseconds(), in_seconds(), operator+(), operator+=(), operator-=(), operator<(), dtn::ProphetNode::operator=(), operator==(), operator>(), dtntunnel::TCPTunnel::Connection::run(), dtn::ProphetNode::set_age(), and dtn::ProphetNode::time_to_units().

u_int32_t oasys::Time::usec_

Definition at line 29 of file Time.h.

Referenced by cleanup(), get_time(), in_microseconds(), in_milliseconds(), in_seconds(), operator+(), operator+=(), operator-=(), operator<(), dtn::ProphetNode::operator=(), operator==(), operator>(), dtntunnel::TCPTunnel::Connection::run(), dtn::ProphetNode::set_age(), and dtn::ProphetNode::time_to_units().


The documentation for this struct was generated from the following files:
Generated on Thu Jun 7 16:57:03 2007 for DTN Reference Implementation by  doxygen 1.5.1