Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

TimeET Class Reference

#include <TimeET.h>

Inheritance diagram for TimeET:

List of all members.


Detailed Description

a nice class for handling time values with high precision

Definition at line 3 of file TimeET.cc.


Public Member Functions

TimeET Age () const
 returns the difference between the current time and the time stored
 TimeET ()
 constructor
 TimeET (long ms)
 constructor
 TimeET (time_t sec, long usec)
 constructor
 TimeET (const timeval &tval)
 constructor
 TimeET (const timespec &tspec)
 constructor
 TimeET (double t)
 constructor, sepecify t seconds
double Value () const
 returns the time stored as seconds in a double
 operator timeval & ()
 returns the time as a timeval system construct
 operator const timeval & () const
 returns the time as a const timeval system construct
 operator timespec ()
 returns the time as a timespec system construct (though the nanosecond resolution isn't actually retained)
time_t getSeconds () const
 returns the seconds portion (not rounded)
long getMilliseconds (long round=us_per_ms/2) const
 returns the millisecond representation (includes both seconds and microseconds contribution); pass 0 to round down, 1000 to round up, 500 to round nearest
long getMicroPortion () const
 returns the microseconds portion (doesn't include seconds)
void Set (long ms)
 sets the time stored in the class in terms of milliseconds
void Set (time_t sec, long usec)
 sets the time in terms of seconds and microseconds (aka timeval)
void Set (double t)
 sets the time in terms of floating-point seconds
void Set ()
 sets the time to the current time
bool operator< (long ms) const
 for comparing times
bool operator< (double t) const
 for comparing times
bool operator< (const TimeET &t) const
 for comparing times
TimeET operator+ (const TimeET &t) const
 for doing doing math with time
TimeET operator+= (const TimeET &t)
 for doing doing math with time
TimeET operator- (const TimeET &t) const
 for doing doing math with time
TimeET operator-= (const TimeET &t)
 for doing doing math with time
TimeET operator * (double x) const
 for doing doing math with time
TimeET operator *= (double x)
 for doing doing math with time
TimeET operator/ (double x) const
 for doing doing math with time
TimeET operator/= (double x)
 for doing doing math with time

Static Public Attributes

static const long us_per_sec = 1000000
 conversion factor for microseconds to seconds
static const long ms_per_sec = 1000
 conversion factor for milliseconds to seconds
static const long us_per_ms = 1000
 conversion factor for microseconds to milliseconds
static const long ns_per_us = 1000
 conversion factor for nanoseconds to microseconds

Protected Attributes

timeval tv
 stores the time

Static Protected Attributes

static struct timezone tz
 stores the timezone (not really used)

Friends

std::ostream & operator<< (std::ostream &o, const TimeET &t)
 lets the class be displayed easily

Constructor & Destructor Documentation

TimeET::TimeET (  )  [inline]

constructor

Definition at line 19 of file TimeET.h.

Referenced by Age(), operator *(), operator+(), operator-(), and operator/().

TimeET::TimeET ( long  ms  )  [inline]

constructor

Definition at line 22 of file TimeET.h.

TimeET::TimeET ( time_t  sec,
long  usec 
) [inline]

constructor

Definition at line 25 of file TimeET.h.

TimeET::TimeET ( const timeval &  tval  )  [inline]

constructor

Definition at line 28 of file TimeET.h.

TimeET::TimeET ( const timespec &  tspec  )  [inline]

constructor

Definition at line 29 of file TimeET.h.

TimeET::TimeET ( double  t  )  [inline]

constructor, sepecify t seconds

Definition at line 33 of file TimeET.h.


Member Function Documentation

TimeET TimeET::Age (  )  const [inline]

returns the difference between the current time and the time stored

Definition at line 39 of file TimeET.h.

Referenced by project_get_time::default_get_time_callback(), Profiler::Timer::elapsed(), PollThread::interrupted(), PollThread::run(), and Profiler::setCurrent().

double TimeET::Value (  )  const [inline]

returns the time stored as seconds in a double

Definition at line 42 of file TimeET.h.

Referenced by project_get_time::default_get_time_callback(), Profiler::finished(), operator<(), Profiler::report(), and Profiler::setCurrent().

TimeET::operator timeval & (  )  [inline]

returns the time as a timeval system construct

Definition at line 44 of file TimeET.h.

TimeET::operator const timeval & (  )  const [inline]

returns the time as a const timeval system construct

Definition at line 46 of file TimeET.h.

TimeET::operator timespec (  )  [inline]

returns the time as a timespec system construct (though the nanosecond resolution isn't actually retained)

Definition at line 48 of file TimeET.h.

time_t TimeET::getSeconds (  )  const [inline]

returns the seconds portion (not rounded)

Definition at line 53 of file TimeET.h.

long TimeET::getMilliseconds ( long  round = us_per_ms/2  )  const [inline]

returns the millisecond representation (includes both seconds and microseconds contribution); pass 0 to round down, 1000 to round up, 500 to round nearest

Definition at line 55 of file TimeET.h.

long TimeET::getMicroPortion (  )  const [inline]

returns the microseconds portion (doesn't include seconds)

Definition at line 57 of file TimeET.h.

void TimeET::Set ( long  ms  )  [inline]

sets the time stored in the class in terms of milliseconds

Definition at line 62 of file TimeET.h.

Referenced by PollThread::poll(), Profiler::reset(), Profiler::SectionInfo::reset(), PollThread::run(), Profiler::setCurrent(), Profiler::Timer::start(), and PollThread::start().

void TimeET::Set ( time_t  sec,
long  usec 
) [inline]

sets the time in terms of seconds and microseconds (aka timeval)

Definition at line 66 of file TimeET.h.

void TimeET::Set ( double  t  )  [inline]

sets the time in terms of floating-point seconds

Definition at line 71 of file TimeET.h.

void TimeET::Set (  )  [inline]

sets the time to the current time

Todo:
not getting timeofday on OPEN-R, is time since boot instead...

Definition at line 77 of file TimeET.h.

Referenced by Set(), and TimeET().

bool TimeET::operator< ( long  ms  )  const [inline]

for comparing times

Definition at line 90 of file TimeET.h.

bool TimeET::operator< ( double  t  )  const [inline]

for comparing times

Definition at line 94 of file TimeET.h.

bool TimeET::operator< ( const TimeET t  )  const [inline]

for comparing times

Definition at line 97 of file TimeET.h.

TimeET TimeET::operator+ ( const TimeET t  )  const [inline]

for doing doing math with time

Definition at line 104 of file TimeET.h.

TimeET TimeET::operator+= ( const TimeET t  )  [inline]

for doing doing math with time

Definition at line 110 of file TimeET.h.

TimeET TimeET::operator- ( const TimeET t  )  const [inline]

for doing doing math with time

Definition at line 116 of file TimeET.h.

TimeET TimeET::operator-= ( const TimeET t  )  [inline]

for doing doing math with time

Definition at line 126 of file TimeET.h.

TimeET TimeET::operator * ( double  x  )  const [inline]

for doing doing math with time

Definition at line 136 of file TimeET.h.

TimeET TimeET::operator *= ( double  x  )  [inline]

for doing doing math with time

Definition at line 151 of file TimeET.h.

TimeET TimeET::operator/ ( double  x  )  const [inline]

for doing doing math with time

Definition at line 166 of file TimeET.h.

TimeET TimeET::operator/= ( double  x  )  [inline]

for doing doing math with time

Definition at line 181 of file TimeET.h.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
const TimeET t 
) [friend]

lets the class be displayed easily

Definition at line 218 of file TimeET.h.


Member Data Documentation

const long TimeET::us_per_sec = 1000000 [static]

conversion factor for microseconds to seconds

Definition at line 198 of file TimeET.h.

Referenced by operator *(), operator *=(), operator+(), operator+=(), operator-(), operator-=(), operator/(), operator/=(), Set(), and Value().

const long TimeET::ms_per_sec = 1000 [static]

conversion factor for milliseconds to seconds

Definition at line 199 of file TimeET.h.

Referenced by getMilliseconds(), and operator<().

const long TimeET::us_per_ms = 1000 [static]

conversion factor for microseconds to milliseconds

Definition at line 200 of file TimeET.h.

Referenced by getMilliseconds(), operator<(), and Set().

const long TimeET::ns_per_us = 1000 [static]

conversion factor for nanoseconds to microseconds

Definition at line 201 of file TimeET.h.

Referenced by operator timespec(), and TimeET().

struct timezone TimeET::tz [static, read, protected]

stores the timezone (not really used)

Definition at line 205 of file TimeET.h.

Referenced by Set().


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

Tekkotsu v4.0
Generated Thu Nov 22 00:58:44 2007 by Doxygen 1.5.4