#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.
olsr::utl::TimeVal::TimeVal | ( | const This & | rhs | ) | [inline] |
Copy constructor.
olsr::utl::TimeVal::TimeVal | ( | const ::timeval & | rhs | ) | [inline] |
Copy constructor from timeval standard data structure.
olsr::utl::TimeVal::TimeVal | ( | const unsigned | period | ) | [inline] |
Constructor from period in milliseconds.
olsr::utl::TimeVal::TimeVal | ( | const int | period | ) | [inline] |
Constructor from period in milliseconds. Provided for convenience.
olsr::utl::TimeVal::TimeVal | ( | const double | seconds | ) | [inline] |
Constructor from floating point second count.
int olsr::utl::TimeVal::poll_time | ( | ) | const [inline] |
bool olsr::utl::TimeVal::operator== | ( | const This & | rhs | ) | const [inline] |
Equality operator.
bool olsr::utl::TimeVal::operator!= | ( | const This & | rhs | ) | const [inline] |
bool olsr::utl::TimeVal::operator< | ( | const This & | rhs | ) | const [inline] |
Comparison operator.
bool olsr::utl::TimeVal::operator<= | ( | const This & | rhs | ) | const [inline] |
Comparison operator.
bool olsr::utl::TimeVal::operator> | ( | const This & | rhs | ) | const [inline] |
Comparison operator.
bool olsr::utl::TimeVal::operator>= | ( | const This & | rhs | ) | const [inline] |
Comparison operator.
float olsr::utl::TimeVal::diff | ( | const This & | rhs = now() |
) | const [inline] |
Absolute difference computation method.
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.
TimeVal olsr::utl::TimeVal::operator+ | ( | unsigned | msec | ) | const [inline] |
External addition with integer number of milliseconds.
TimeVal & olsr::utl::TimeVal::operator+= | ( | unsigned | msec | ) | [inline] |
External self-addition with integer number of milliseconds.
TimeVal olsr::utl::TimeVal::operator * | ( | const double & | f | ) | const [inline] |
External multiplication with double.
TimeVal olsr::utl::TimeVal::operator/ | ( | const double & | f | ) | const [inline] |
External division with double.
TimeVal olsr::utl::TimeVal::abs | ( | ) | const [inline] |
Absolute value operator.
olsr::utl::TimeVal::operator::timeval | ( | ) | const [inline] |
Conversion operator to timeval data structure.
Jitter calculation.
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.
float olsr::utl::TimeVal::to_float | ( | ) | const [inline] |
Method to convert to floating point number of seconds.
static const TimeVal& olsr::utl::TimeVal::now | ( | ) | [inline, static] |
Static accessor to current time reference.
const TimeVal olsr::utl::TimeVal::real_now | ( | ) | [inline, static] |
Static accessor to current system time.
Static convenience future time calculation.
Static convenience future jitter time calculation.
timeval olsr::utl::TimeVal::_tv [private] |
The time stored in timeval data structure.
This olsr::utl::TimeVal::_now [static, private] |
Static time reference.