Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Endpoint timer should use steady clock #241

Closed
breyed opened this issue May 22, 2013 · 3 comments
Closed

Endpoint timer should use steady clock #241

breyed opened this issue May 22, 2013 · 3 comments
Labels

Comments

@breyed
Copy link
Contributor

breyed commented May 22, 2013

endpoint::set_timer creates a new boost::asio::deadline_timer. The actual duration that this timer waits changes if the system clock changes. Typically, timeouts related to networking should be independent of changes to the system clock. To achieve independence, use steady_timer instead. See the Boost Clocks documentation for background.

@zaphoyd
Copy link
Owner

zaphoyd commented May 22, 2013

This is a good point. Unfortunately using steady_timer in practice is a bit more complicated. The clock type required does not exist until C++11 and Boost 1.47. The timer type does not exist until Boost 1.49 which is not easily available in many LTS Linux distributions yet. Secondly, many C++11 standard libraries either implement steady_clock as a non-monotonic clock or require extra care when compiling the end user application to actually get the right clocks enabled.

Where it is supported, the steady_clock based timer is definitely the best choice here though. I'll look into options for switching between the two. The Asio transport policy already includes a method to allow this sort of customization so it shouldn't be too difficult.

@zaphoyd
Copy link
Owner

zaphoyd commented Apr 25, 2015

This issue has been addressed on the develop branch and the fix will be included in 0.6.0

@zaphoyd
Copy link
Owner

zaphoyd commented Jun 2, 2015

The 0.6.0 release included this fix.

@zaphoyd zaphoyd closed this as completed Jun 2, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants