[ Boost.Timer ] Simple class ...

15 Sep
2005
15 Sep
'05
11:56 p.m.
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 ?
7228
Age (days ago)
7228
Last active (days ago)
0 comments
1 participants
participants (1)
-
rubicant rubicant