Boost logo

Boost Users :

Subject: Re: [Boost-users] Periodic Timer
From: amit khandelwal (khandelwal.amit_at_[hidden])
Date: 2008-09-09 17:29:39


Also, wouldn't the function call itself have an overhead? If yes, is there a
way to get around it ?

On Tue, Sep 9, 2008 at 5:10 PM, Igor R <boost.lists_at_[hidden]> wrote:

> > void print1()
> > {
> > if (count_ < 100)
> > {
> > timer1_.expires_at(timer1_.expires_at() +
> > boost::posix_time::microseconds(10));
> > timer1_.async_wait(boost::bind(&printer::print1, this));
> > std::cout << "Timer 1: " << count_ << "\n";
> > ++count_;
> >
> > }
> >
>
> > Over a period of time I think it will probably cause some slippage.
>
> This is because you always take a new "reference time".
> I guess that if you store the initial reference-point (when starting
> the timer for the 1st time) and then always add to *it* a
> time_duration*iterationNumber, then the slippage wouldn't accumulate.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
-------------------------------------------------------------------
Ph : (732) 647 5679
Email: khandelwal.amit_at_[hidden]
Web: http://khandelwal.amit.googlepages.com/home
-------------------------------------------------------------------


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net