Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-06-26 05:17:11

"Jeff Garland" wrote
> As for the interface, I'm almost amused that this pretty much trivial
> interface continues to bring discussion. The timer proposal that's in the
> vault now had the interface discussed at some length (see
> for
> some links. The sketch for this is:
> class timer {
> timer(time_duration initial_duration = time_duration(0,0,0),
> void start();
> void restart() ;
> time_duration elapsed() const;
> void pause();
> void resume();
> void reset();
> };

FWIW I thought I should add my own timer efforts. None too serious, but the
unique (AFAICS) feature is that you can select different time units:
Its in <boost/pqs/utility/timer.hpp> and looks like this( This version moved to
quan namespace) :

amespace quan{

    template <typename TimeType = quan::time::ms>
    class timer{
        void restart();
        void stop() ;
        TimeType operator ()()const;
        bool is_running() const ;
        bool is_stopped() const;
int main()
    int const num_loops=10;
    quan::timer<quan::time::ms> t; // construction starts timing
    for(int j = 0; j < num_loops; ++j){
    std::cout << t() << "\n";

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at