Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends
jafar::ddf::time Class Reference

A toolbox for time management (absolute and duration). More...


Detailed Description

A toolbox for time management (absolute and duration).

Converts from/in different other time structures such as timeval, double, xtime and provides sleep functions.

Author:
Sylvain Joyeux, Pierre Lamon

Definition at line 22 of file ctime.hpp.

#include <ctime.hpp>

List of all members.

Public Types

typedef time_t sec_t
typedef suseconds_t usec_t

Public Member Functions

 time (sec_t sec=0, usec_t usec=0)
 Initializes the time at (0, 0)
 time (double d)
 Initializes with a double (in sec)
 time (timeval const &t)
 Initializes the time using the given time structure We assume that t is already well-formed (i.e.
bool is_normal () const
bool is_infty () const
bool is_null () const
time_t s () const
time_t ms () const
time_t us () const
timeval to_timeval () const
timespec to_timespec () const
double to_double () const
boost::xtime to_xtime () const
void sleep_period () const
void sleep_until () const
bool check_close (time const &other, time const &epsilon) const
bool operator> (const time &t) const
bool operator>= (const time &t) const
bool operator< (const time &t) const
bool operator<= (const time &t) const
bool operator== (const time &t) const
bool operator!= (const time &t) const
time operator- (const time &other) const
time operator+ (const time &other) const
time operator/ (double divider) const
time operator* (double multipl) const
void operator= (const time &other)

Static Public Member Functions

static time infty ()
 A special time object handled as "infty".
static time null ()
static time current ()
static time from_ms (int msecs)
 Get a time object from a milliseconds count.
static time from_us (int usecs)

Static Public Attributes

static const int UsecPerSec = 1000000

Private Types

enum  Type { Normal, Infty }

Private Member Functions

 time (Type mode)
void assign (sec_t sec, usec_t usec)
int compare (time const &other) const

Private Attributes

Type m_type
sec_t m_sec
usec_t m_usec

Friends

std::istream & operator>> (std::istream &stream, time &t)
std::ostream & operator<< (std::ostream &stream, const time &t)

Constructor & Destructor Documentation

jafar::ddf::time::time ( timeval const &  t) [inline, explicit]

Initializes the time using the given time structure We assume that t is already well-formed (i.e.

the microsecond count is no more than UsecPerSec)

Definition at line 66 of file ctime.hpp.


Member Function Documentation

static time jafar::ddf::time::infty ( ) [inline, static]

A special time object handled as "infty".

  • infty < a and a > infty return false
  • infty > a and a < infty return true
  • a - now = a
  • now - a is undefined (even if a == now)
  • a + now = a

Definition at line 81 of file ctime.hpp.

Referenced by jafar::ddf::SensorNodeGeneric< PARAMS >::PurgeFifo().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:33 for Jafar by doxygen 1.7.6.1
LAAS-CNRS