CH_Tools::Microseconds Class Reference
[Clock (time measurement in Microseconds)]

extra long integer number for expressing and computing time measurements in microseconds. More...

#include <clock.hxx>

List of all members.

Public Member Functions

Constructors
 Microseconds ()
 default constructor, value 0
 Microseconds (bool infty)
 constructor for setting value to 0 or infinity
 Microseconds (const Microseconds &m)
 copy constructor
 Microseconds (long secs, long msecs=0)
 specify directly seconds and microseconds (in [0,10^6], no range check!)
 Microseconds (int secs, int msecs=0)
 specify directly seconds and microseconds (in [0,10^6], no range check!)
 Microseconds (long hours, long minutes, long secs, long micros)
 convert hours, minutes, secs, micros to Microseconds (no range check!)
 Microseconds (int hours, int minutes, int secs, int micros)
 convert hours, minutes, secs, micros to Microseconds (no range check!)
Arithmetic operations and comparisons
Microsecondsoperator= (const Microseconds &m)
Microsecondsoperator+= (const Microseconds &m)
Microsecondsoperator-= (const Microseconds &m)
Microseconds operator- (const Microseconds &m) const
Microseconds operator+ (const Microseconds &m) const
bool operator< (const Microseconds &m) const
bool operator> (const Microseconds &m) const
bool operator<= (const Microseconds &m) const
bool operator>= (const Microseconds &m) const
bool operator== (const Microseconds &m) const
set, get, rounding, and conversions
void set_infinity (bool infty)
 use true to regard value as infinity
bool get_infinity () const
 if true, value should be regarded as infinity
 operator double () const
 convert to a double, where the size of one unit is one second(!)
void hhmmss (long &hours, long &minutes, long &secs) const
 convert and store the value of (*this) to hours, minutes, seconds
void hhmmssdd (long &hours, long &minutes, long &secs, long &hund) const
 convert and store the value of (*this) to hours, minutes, seconds, hundredths
long roundsecs () const
 round the value to seconds
long roundhundredths () const
 round the value to hundredths

Private Attributes

bool infinity
 if true, the value is regarded as infinity
long seconds
 counts time portion in seconds
long microsecs
 number in [0,10^6] counting the remaining microseconds without seconds

Friends

Input and Output
std::ostream & operator<< (std::ostream &out, const Microseconds &m)
 output in the format "seconds.microseconds" or "-1.000000" for infinity
std::istream & operator>> (std::istream &in, Microseconds &m)
 input in the format "seconds.microseconds" , seconds<0 is regarded as infinity
void print_time (std::ostream &out, const Microseconds &m, int secondsonly=0)
 print Microseconds in the format "hh:mm:ss.dd" or "hh:mm:ss"


Detailed Description

extra long integer number for expressing and computing time measurements in microseconds.

All operations assume that values and results of additions and subtractions are nonnegative, but this is not explicitly enforced.

Internally Microseconds consits of two long values, seconds and microsecs, where microseconds is always <= 10^6 and any overflow is passed on to seconds.


Friends And Related Function Documentation

void print_time ( std::ostream &  out,
const Microseconds m,
int  secondsonly = 0 
) [friend]

print Microseconds in the format "hh:mm:ss.dd" or "hh:mm:ss"

Parameters:
out  output stream
m  time
secondsonly  use =0 for "hh:mm:ss.dd", !=0 for "hh:mm:ss"


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

Generated on Tue May 3 16:52:54 2011 for ConicBundle by  doxygen 1.5.6