#6835 closed Bugs (invalid)
Timer and Sleep issues with system clock
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.48.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Hi,
I think there is an isue currently with some of the classes that use time sensitive code.
After a quick look, I found that boost::deadline_timer and this_thread::sleep() were sensitive to system clock change.
Even if using durations (instead of relative times) setting the system clock back affects those timers.
Do you know what might be the cause of such behavior (eventhough duration is used)?
Thanks
Change History (6)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
The asio::deadline_timer typedef uses the UTC clock, as documented here.
If you don't want to be sensitive to UTC clock changes then use the new asio::steady_timer typedef, or write your own custom time traits to use an alternative clock as shown in this example.
follow-up: 4 comment:3 by , 10 years ago
Hi chris,
Thanks for the steady_timer pointer. Do you have a similar suggestion for other timing related calls? (this_thread::sleep)
Regards, Luc
Hi,
Anybody witnessed the same issue or tried to replicate it?
This can cause serious issues in some situations where the clock is set when the code is running.
Thanks