#include <clock.hxx>
Public Member Functions | |
void | start () |
read current time, all further time measurements will be in relation to this time | |
Clock () | |
calls start() | |
~Clock () | |
nothing particular | |
void | set_offset (Microseconds offs) |
allows to specify an offset, that will furtheron be added to all time measurements | |
Microseconds | time () const |
return time elapsed since last call to start() in Microseconds (possibly adding an optional offset) | |
void | elapsed_time (std::ostream &out) const |
call time() and print the result in format "hh:mm:ss", togehter with current date and time, to out | |
Private Attributes | |
Microseconds | t_start |
Microseconds | offset |
long | l_start |
Friends | |
std::ostream & | operator<< (std::ostream &out, const Clock &cl) |
call cl.time() and print the result in format "hh:mm:ss" to out |
the clock is initiliazed by calling start() (this also happens automatically at construction) and returns, at each call to time(), the time passed since the last call to start() in Microseconds (optionally plus a given offset specified by set_offset() ). The routine elapsed_time() prints the current time difference together with current date and time to an output strean.