Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-10-31 22:48:46


----- Original Message -----
From: "Toon Knapen" <toon.knapen_at_[hidden]>
> I need to be able to toggle the timer on and off. Since I want to
> calculate the total time spend in some function I need to toggle the
> timer off everytime the program leaves the function and back on
> everytime the program enters the function again.
> So I propose to add a member called `toggle()`.
> A drawback though is that you need to `toggle` the timer back on before
> asking the `elapsed()` time (otherwise I would need a bit to indicate if
> the timer is on or off which increases the memory footprint. Maybe I
> could use the MSB of the clock_t as a hack)

I suggest we pay for the extra bit. "Toggle" is more error-prone and less
explicit than a start/stop interface anyway.

-Dave

===================================================
  David Abrahams, C++ library designer for hire
 resume: http://users.rcn.com/abrahams/resume.html

        C++ Booster (http://www.boost.org)
          email: david.abrahams_at_[hidden]
===================================================


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk