Boost logo

Boost Users :

Subject: Re: [Boost-users] Interval Timer
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-09-22 01:47:19


Le 22/09/11 07:15, asif saeed a écrit :
> Diederick,
>
> On Wed, Sep 21, 2011 at 7:52 PM, Diederick C. Niehorster
> <dcnieho_at_[hidden] <mailto:dcnieho_at_[hidden]>> wrote:
>
> Can you start googling instead of just asking everything? I know
> nothing about the topic but a quick google brings up asio's
> deadline_timer frequently, have a look at that. e.g.
> http://stackoverflow.com/questions/4267546/c-boost-asio-simple-periodic-timer
>
> You could have found this in much less time than it took to fire an
> email to the list...
>
> On Wed, Sep 21, 2011 at 20:14, asif saeed <asif.lse2_at_[hidden]
> <mailto:asif.lse2_at_[hidden]>> wrote:
> > Hi,
> > I need an interval timer to continuously call my callback
> function after
> > every n milliseconds/seconds for ever once I set it up. I also
> need the
> > ability to kill/cancel the timer. Does Boost provide such a
> facility now?
>
>
> In fact, I did google a bit before "firing" an email! The thing is
> that I had inquired about it already sometime ago on this mailing list
> and it turned out that ASIO Deadline Timer does not work well when the
> host time changes. Unfortunately, host time does change quite often
> where my app is supposed to run. So, I was wondering if another better
> solution has emerged in Boost libraries. I also looked at Chrono but
> it was not immediately apparent to me as to whether it does support
> periodic interval timer or not.
>
> Peace, Asif
>
Hi,

Boost.Chrono doesn't provides such a mechanis :( Now that Boost.Chrono
has been released, it seems that Boost.Asio is the library that could
take care of your needs.

This could happen if the used clock is not steady. I don't know if
Boost.Asio uses an steady clock or a system clock. I guess that it
should use one steady. Maybe you can make a simple test to verify this,
and if you verify the issue, you could create a ticket.

I don't know if Asio provides or not periodic timers. If what you want
is periodic timers and if Boost.Asio doesn't provide them, you could add
a feature request for Asio to the Trac system.

Best,
Vicente



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