
Greetings.
I programming library that I use (WT) had a bug in their asynchronous
timer handling, and although they fixed it, they are thinking of
moving over to Boost::ASIO timers since they already use Boost::ASIO
for the networking stack. However, an interesting question was posed
about how Boost::ASIO timers handle the time changing on the host
computer (which is a possible scenario for this library due to its
up-time requirements). Below is the basic part of the thread in
question. Does anyone know the answer? I attempted a quick look
through the timer source, however I cannot really seem to tell since I
know not the internals of ASIO nor the posix datetime library in
Boost...
On Fri, Nov 20, 2009 at 12:55 AM, Pau Garcia i Quiles

Hello,
Answering myself (in a different mailing list, no less!), I'd say
deadline_timer is broken.
I've tested with the time_t_timer.cpp example from Asio itself. The
test is very easy:
- Say now it's 14:19:10
- Start time_t_timer
- Set time one hour back (to 13:19:10)
- Timers never expire (it doesn't matter if you do wait() or async_wait() )
Tested on Mac OS X 10.6.2. To make testing easier, I set the expiry
time to 20 seconds and used only one timer at a time (i. e. I
commented out the second half of the example the first time and had
only the wait() first, then did the opposite).
One intriguing issue is if instead of setting the time back one our,
you set the time forward one hour (15:19:10), the timer works. I don't
have time to research why this happens (I was expecting the test to
fail, too, as the point in time the timer is set to expire is never
reached exactly but just passed by).
On Sat, Nov 21, 2009 at 3:12 AM, OvermindDL1
-- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer)

On Sat, 21 Nov 2009 14:24:35 +0100, Pau Garcia i Quiles
Well it doesn't really work either. The timer expires imidiatly becourse the time has passed. But if the thread doesn't do anything else but wait for that it will not wakeup before the original time has passed. If it wakes though; the timer gets recalculated. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
participants (3)
-
Bjarne Laursen
-
OvermindDL1
-
Pau Garcia i Quiles