
Hi, Can I use Boost Timer or Boost DateTime to trigger callbacks? I just want to be able to have the timer/date-time class trigger my handler functions after every 10 seconds for example or trigger a callback handling function after 25 seconds and die. Is that possible with Boost libraries? I am asking this question because, after a cursory look, it appears to me that there is no such facility right now - if this is true, do you suggest any portable library offering this functionality? Thank you, Asif

Hello, you might want to take a look at the ASIO reference. There you'll find the deadline_timer with which you can do exactly what you want. Regards, Andreas On 05/26/2011 09:06 AM, asif saeed wrote:
Hi,
Can I use Boost Timer or Boost DateTime to trigger callbacks? I just want to be able to have the timer/date-time class trigger my handler functions after every 10 seconds for example or trigger a callback handling function after 25 seconds and die. Is that possible with Boost libraries? I am asking this question because, after a cursory look, it appears to me that there is no such facility right now - if this is true, do you suggest any portable library offering this functionality?
Thank you, Asif
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Dipl.-Ing. (FH) Andreas Wehrmann Software Development -------------------------------------------------------------- Center Communication Systems GmbH A-1210 Wien, Ignaz-Köck-Straße 19 Sitz in Wien FN 796 88p, Firmenbuchgericht Wien www.centersystems.com Tel.: +43 (0) 190 199 - 3616 Mobile: +43 (0) 664 884 75916 Fax: +43 (0) 190 199 - 2110 E-Mail: a.wehrmann@centersystems.com

"Andreas Wehrmann" wrote:
On 05/26/2011 09:06 AM, asif saeed wrote:
Can I use Boost Timer or Boost DateTime to trigger callbacks? I just want to be able to have the timer/date-time class trigger my handler functions after every 10 seconds for example or trigger a callback handling function after 25 seconds and die.
you might want to take a look at the ASIO reference. There you'll find the deadline_timer with which you can do exactly what you want.
deadline_timer from Asio is not a good choice for these scenarios since in won't work properly if the system time changes. See http://svn.boost.org/trac/boost/ticket/3504 (but beware of bad code in the attachments). Since the next version of Boost will contain boost::chrono::steady_clock, I'm hopeful that Asio will get a better timer.

Quoting Niklas Angare
"Andreas Wehrmann" wrote:
On 05/26/2011 09:06 AM, asif saeed wrote:
Can I use Boost Timer or Boost DateTime to trigger callbacks? I just want to be able to have the timer/date-time class trigger my handler functions after every 10 seconds for example or trigger a callback handling function after 25 seconds and die.
you might want to take a look at the ASIO reference. There you'll find the deadline_timer with which you can do exactly what you want.
deadline_timer from Asio is not a good choice for these scenarios since in won't work properly if the system time changes. See http://svn.boost.org/trac/boost/ticket/3504 (but beware of bad code in the attachments).
Since the next version of Boost will contain boost::chrono::steady_clock, I'm hopeful that Asio will get a better timer.
Alright, I take it back then. I wasn't aware of the fact that boost::asio::deadline_timer are susceptible to time changes. Regards, Andreas ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.
participants (3)
-
Andreas Wehrmann
-
asif saeed
-
Niklas Angare