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 11 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 15 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 18 of file Time.cc.

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

Referenced by elapsed_ms(), oasys::TokenBucket::empty(), dtn::BundleDaemon::run(), oasys::TokenBucket::TokenBucket(), and oasys::TokenBucket::update().

double oasys::Time::in_seconds (  ) 

Returns:
Time in seconds as a floating point number

Definition at line 59 of file Time.cc.

References sec_, and usec_.

u_int32_t oasys::Time::in_microseconds (  ) 

Returns:
Time in microseconds

Definition at line 67 of file Time.cc.

References sec_, and usec_.

u_int32_t oasys::Time::in_milliseconds (  ) 

Returns:
Time in milliseconds

Definition at line 74 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 81 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 91 of file Time.cc.

References sec_, Time(), and usec_.

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

Standard operators.

Definition at line 123 of file Time.cc.

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

Standard operators.

Definition at line 98 of file Time.cc.

References cleanup(), sec_, and usec_.

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

Standard operators.

Definition at line 108 of file Time.cc.

References sec_, and usec_.

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

Standard operators.

Definition at line 133 of file Time.cc.

References sec_, and usec_.

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

Standard operators.

Definition at line 140 of file Time.cc.

References sec_, and usec_.

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

Standard operators.

Definition at line 148 of file Time.cc.

References sec_, and usec_.

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

Standard operators.

Definition at line 163 of file Time.cc.

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

Standard operators.

Definition at line 156 of file Time.cc.

void oasys::Time::cleanup (  ) 

Cleanup the usec field wrt. sec.

Definition at line 170 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 12 of file Time.h.

Referenced by cleanup(), get_time(), in_microseconds(), in_milliseconds(), in_seconds(), operator+(), operator+=(), operator-=(), operator<(), operator==(), and operator>().

u_int32_t oasys::Time::usec_

Definition at line 13 of file Time.h.

Referenced by cleanup(), get_time(), in_microseconds(), in_milliseconds(), in_seconds(), operator+(), operator+=(), operator-=(), operator<(), operator==(), and operator>().


The documentation for this struct was generated from the following files:
Generated on Fri Dec 22 14:48:08 2006 for DTN Reference Implementation by  doxygen 1.5.1