Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-06-25 20:11:19

Gennaro Prota wrote:
> On Sun, 25 Jun 2006 10:00:46 -0400, Beman Dawes <bdawes_at_[hidden]>
> wrote:
> It seems that everyone is writing timers in this period :) I've my
> implementation too, resulting from preliminary off-list discussion
> with Pavel Vozenilek. It's similar to yours but I was not happy with
> the interface,

Which interface?

> and also wanted to make it interoperable with
> Boost.Date_Time without actually coupling with it.

Well, this can certainly be done but is it really worth it? From what I can
see you basically end up with something requiring 3 template parameters
instead of one (time type, duration type, clock type). Clock type is the one
that's really necessary to allow for different implementations of time
measurement. Is the coupling with date-time really so extreme? Everything
you need for the timers is all header inline. Have you looked at:

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),
         START_OPTION start_op = AUTO_START);

   void start();
   void restart() ;
   time_duration elapsed() const;
   void pause();
   void resume();
   void reset();

Now I appreciate that what Beman is trying to do is slightly different so what
he wants from the elapsed call doesn't match up. That said, I'm not sure that
there needs to be so much variation in the rest of the interface.


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