#include <timeval.hh>
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 |
This & | operator+= (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 |
This & | operator+= (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 TimeVal & | now () |
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. |
This class encapsulates all the required time operations.
typedef TimeVal olsr::utl::TimeVal::This [private] |
olsr::utl::TimeVal::TimeVal | ( | unsigned | sec, | |
unsigned | usec | |||
) | [inline] |
Constructor.
References _tv.
Referenced by operator+(), and real_now().
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.
int olsr::utl::TimeVal::poll_time | ( | ) | const [inline] |
References _tv.
Internal addition.
References _tv.
Internal subtraction.
References _tv.
Internal self-addition.
References _tv.
bool olsr::utl::TimeVal::operator== | ( | const This & | rhs | ) | const [inline] |
bool olsr::utl::TimeVal::operator!= | ( | const This & | rhs | ) | const [inline] |
References operator==().
bool olsr::utl::TimeVal::operator< | ( | const This & | rhs | ) | const [inline] |
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] |
References distance(), and to_float().
Referenced by olsr::sch::Scheduler::erase(), olsr::sch::Scheduler::handle_tevents(), and olsr::sch::Scheduler::insert().
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.
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] |
TimeVal & olsr::utl::TimeVal::operator+= | ( | unsigned | msec | ) | [inline] |
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.
olsr::utl::TimeVal::operator::timeval | ( | ) | const [inline] |
Conversion operator to timeval data structure.
References _tv.
Jitter calculation.
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] |
static const TimeVal& olsr::utl::TimeVal::now | ( | ) | [inline, static] |
Static accessor to current time reference.
Referenced by olsr::msg::TCMessage::dump(), olsr::msg::MIDMessage::dump(), olsr::msg::HNAMessage::dump(), olsr::msg::HELLOMessage::dump(), olsr::sch::StatePrinter::handle(), olsr::sch::Scheduler::handle_tevents(), olsr::set::CoherenceProxy::insert_link(), olsr::sch::Scheduler::loop(), and olsr::set::Neighbor::unset_mprsel().
const TimeVal olsr::utl::TimeVal::real_now | ( | ) | [inline, static] |
Static accessor to current system time.
References TimeVal().
Static convenience future time calculation.
References _now.
Referenced by olsr::msg::TCMessage::dump(), olsr::msg::MIDMessage::dump(), olsr::msg::HNAMessage::dump(), olsr::msg::HELLOMessage::dump(), olsr::set::CoherenceProxy::insert_link(), olsr::sch::QolyesterLoopHandler::operator()(), olsr::msg::TCMessage::parse(), olsr::pkt::Packet::parse(), olsr::set::CoherenceProxy::set_mprsel(), and olsr::set::Neighbor::set_mprsel().
Static convenience future jitter time calculation.
Referenced by olsr::msg::Message::forward().
timeval olsr::utl::TimeVal::_tv [private] |
The time stored in timeval data structure.
Referenced by abs(), jitter(), operator*(), operator+(), operator+=(), operator-(), operator/(), operator::timeval(), operator<(), operator==(), poll_time(), TimeVal(), and to_float().
This olsr::utl::TimeVal::_now [static, private] |