Boost logo

Boost :

From: Silex (silex0r_at_[hidden])
Date: 2006-05-16 04:54:17


Ok, here's the new templated timer class from the suggestions.

It's basically the code from Jeff with extensions and some slight
corrections. Jeff, can you validate/correct the header text about
copyrights ? I'm really not used to this so I did how I thought it
should be done.

I added two templates for the time type and time_duration type to make
it more generic :

template<class clock_type, class time_type = boost::posix_time::ptime,
class time_duration_type = boost::posix_time::time_duration> class
timer {};

I also added two typedefs for convenience:

typedef boost::timer<boost::posix_time::second_clock> second_timer;
typedef boost::timer<boost::posix_time::microsec_clock> microsec_timer;

To see it in action do as usual, copy timer_new.hpp to the boost
folder and compile main.cpp.

This code seems to works fine on both windows & unixes and seems to do
microsecond resolution as provided by
boost::posix_time::microsec_clock. Now the question is, how should I
do another microsec_clock class based on QPC or timeGetTime ? It's
obvious that if I do one, it should not be used by the user as
localtime() would not have a real meaning.

As the initial goal is somewhat attained, do we want to make a QPC
implementation at all ? At the moment the pros here are that we only
change timer.hpp and the cons is a possible overhead on windows.

Waiting of hearing from you :)
Philippe




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