ConicBundle
Private Attributes | List of all members
CH_Tools::Microseconds Class Reference

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

#include <clock.hxx>

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" More...
 

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

◆ print_time

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
outoutput stream
mtime
secondsonlyuse =0 for "hh:mm:ss.dd", !=0 for "hh:mm:ss"

Referenced by CH_Tools::Clock::elapsed_time().


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