olsr::utl::TimeVal Class Reference

Proxy class for the timeval standard C data structure. More...

#include <timeval.hh>

List of all members.

Public Member Functions

 TimeVal (unsigned sec, unsigned usec)
 TimeVal (const This &rhs)
 TimeVal (const ::timeval &rhs)
 TimeVal (const unsigned period)
 TimeVal (const int period)
 TimeVal (const double seconds)
int poll_time () const
This operator+ (const This &rhs) const
This operator- (const This &rhs) const
Thisoperator+= (const This &rhs)
bool operator== (const This &rhs) const
bool operator!= (const This &rhs) const
bool operator< (const This &rhs) const
bool operator<= (const This &rhs) const
bool operator> (const This &rhs) const
bool operator>= (const This &rhs) const
float diff (const This &rhs=now()) const
This distance (const This &rhs) const
bool is_past (const This &now=now()) const
This operator+ (unsigned msec) const
Thisoperator+= (unsigned msec)
This operator* (const double &f) const
This operator/ (const double &f) const
This abs () const
 operator::timeval () const
float to_float () const

Static Public Member Functions

static This jitter (const This &j)
static void set_now (const This &now=TimeVal::real_now())
static const TimeValnow ()
static const TimeVal real_now ()
static const TimeVal in (const This &x)
static const TimeVal in_jitter (const This &x)

Private Types

typedef TimeVal This

Private Attributes

timeval _tv
 The time stored in timeval data structure.

Static Private Attributes

static This _now
 Static time reference.


Detailed Description

Proxy class for the timeval standard C data structure.

This class encapsulates all the required time operations.


Member Typedef Documentation

typedef TimeVal olsr::utl::TimeVal::This [private]


Constructor & Destructor Documentation

olsr::utl::TimeVal::TimeVal ( unsigned  sec,
unsigned  usec 
) [inline]

Constructor.

  • sec seconds
  • usec microseconds

References _tv.

Referenced by operator+(), and real_now().

olsr::utl::TimeVal::TimeVal ( const This rhs  )  [inline]

Copy constructor.

References _tv.

olsr::utl::TimeVal::TimeVal ( const ::timeval &  rhs  )  [inline]

Copy constructor from timeval standard data structure.

References _tv.

olsr::utl::TimeVal::TimeVal ( const unsigned  period  )  [inline]

Constructor from period in milliseconds.

References _tv.

olsr::utl::TimeVal::TimeVal ( const int  period  )  [inline]

Constructor from period in milliseconds. Provided for convenience.

References _tv.

olsr::utl::TimeVal::TimeVal ( const double  seconds  )  [inline]

Constructor from floating point second count.

References _tv.


Member Function Documentation

int olsr::utl::TimeVal::poll_time (  )  const [inline]

References _tv.

TimeVal olsr::utl::TimeVal::operator+ ( const This rhs  )  const [inline]

Internal addition.

References _tv.

TimeVal olsr::utl::TimeVal::operator- ( const This rhs  )  const [inline]

Internal subtraction.

References _tv.

TimeVal & olsr::utl::TimeVal::operator+= ( const This rhs  )  [inline]

Internal self-addition.

References _tv.

bool olsr::utl::TimeVal::operator== ( const This rhs  )  const [inline]

Equality operator.

References _tv.

Referenced by operator!=().

bool olsr::utl::TimeVal::operator!= ( const This rhs  )  const [inline]

References operator==().

bool olsr::utl::TimeVal::operator< ( const This rhs  )  const [inline]

Comparison operator.

References _tv.

Referenced by operator>=().

bool olsr::utl::TimeVal::operator<= ( const This rhs  )  const [inline]

Comparison operator.

Referenced by operator>().

bool olsr::utl::TimeVal::operator> ( const This rhs  )  const [inline]

Comparison operator.

References operator<=().

bool olsr::utl::TimeVal::operator>= ( const This rhs  )  const [inline]

Comparison operator.

References operator<().

float olsr::utl::TimeVal::diff ( const This rhs = now()  )  const [inline]

TimeVal olsr::utl::TimeVal::distance ( const This rhs  )  const [inline]

Absolute difference computation method.

Referenced by diff().

bool olsr::utl::TimeVal::is_past ( const This now = now()  )  const [inline]

Realistic comparison operator. This takes into account the jitter in signal delivery time. FIXME: this should not be necessary, according to the specifications, but seems to be according to experiments.

  • now right-hand-side operand, default is now

Referenced by olsr::sch::PeriodicEvent_< I >::handle(), olsr::set::Neighbor::is_mprsel(), olsr::set::Link::is_sym(), olsr::set::TopologyEntry::is_valid(), olsr::set::Link::is_valid(), olsr::set::TwoHopNeighbor::is_valid(), olsr::set::MIDEntry::is_valid(), olsr::set::HNAEntry::is_valid(), olsr::set::DuplicateEntry::is_valid(), and olsr::set::upd::LinkUpdater::min_time().

TimeVal olsr::utl::TimeVal::operator+ ( unsigned  msec  )  const [inline]

External addition with integer number of milliseconds.

References TimeVal().

TimeVal & olsr::utl::TimeVal::operator+= ( unsigned  msec  )  [inline]

External self-addition with integer number of milliseconds.

References _tv.

TimeVal olsr::utl::TimeVal::operator* ( const double &  f  )  const [inline]

External multiplication with double.

References _tv.

TimeVal olsr::utl::TimeVal::operator/ ( const double &  f  )  const [inline]

External division with double.

References _tv.

TimeVal olsr::utl::TimeVal::abs (  )  const [inline]

Absolute value operator.

References _tv.

olsr::utl::TimeVal::operator::timeval (  )  const [inline]

Conversion operator to timeval data structure.

References _tv.

TimeVal olsr::utl::TimeVal::jitter ( const This j  )  [inline, static]

Jitter calculation.

  • j upper bound of random jitter

References _tv.

Referenced by olsr::sch::internal::JitterIncrement::operator()(), and olsr::sch::QolyesterLoopHandler::operator()().

void olsr::utl::TimeVal::set_now ( const This now = TimeVal::real_now()  )  [inline, static]

Clock stepping. Called once in a while to set current time.

References _now.

Referenced by olsr::sch::Scheduler::loop().

float olsr::utl::TimeVal::to_float (  )  const [inline]

Method to convert to floating point number of seconds.

References _tv.

Referenced by diff().

static const TimeVal& olsr::utl::TimeVal::now (  )  [inline, static]

const TimeVal olsr::utl::TimeVal::real_now (  )  [inline, static]

Static accessor to current system time.

References TimeVal().

const TimeVal olsr::utl::TimeVal::in ( const This x  )  [inline, static]

static const TimeVal olsr::utl::TimeVal::in_jitter ( const This x  )  [inline, static]

Static convenience future jitter time calculation.

  • x time jitter
    Returns:
    now + jitter(x)

Referenced by olsr::msg::Message::forward().


Member Data Documentation

timeval olsr::utl::TimeVal::_tv [private]

This olsr::utl::TimeVal::_now [static, private]

Static time reference.

Referenced by in(), and set_now().


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

Generated on Thu Feb 12 20:45:40 2009 for Qolyester daemon by  doxygen 1.5.6