|
Boost : |
From: rubicant rubicant (rubicant.rubicant_at_[hidden])
Date: 2005-09-15 18:56:10
Hey hello people ! I'm new so be nice ;-)
I was trying to use boost.timer but it didnt work like i wanted :-)
So I made this class wich is very simple and does exactly what one would
think it does.
// start timer.hpp
#include <ctime>
class timer
{
public:
timer();
unsigned int elapsed(); // returns elapsed time since ctor or restart()
void restart(); // restarts the timer
private:
unsigned int start_t;
};
timer::timer() : start_t(std::time(0)) { }
unsigned int timer::elapsed()
{
return (std::time(0) - start_t);
}
void timer::restart()
{
start_t = std::time(0);
}
// end timer.hpp
As you can see its very clean and simple to use enjoy ! ...maybe put it in
boost timer ;-D ?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk