From 95fa2c3708ee5e365a7bbbc7eda8bfabda41d7b1 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Tue, 5 Apr 2022 17:11:05 +1000 Subject: [PATCH] Update timer overview in terms of waitable timers. --- doc/overview/timers.qbk | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/doc/overview/timers.qbk b/doc/overview/timers.qbk index 7dd304d6ca..fbd6259476 100644 --- a/doc/overview/timers.qbk +++ b/doc/overview/timers.qbk @@ -16,8 +16,8 @@ relative time one may write: io_context i; ... - deadline_timer t(i); - t.expires_from_now(boost::posix_time::seconds(5)); + steady_timer t(i); + t.expires_after(chrono::seconds(5)); t.wait(); More commonly, a program will perform an asynchronous wait operation on a @@ -27,26 +27,27 @@ timer: ... io_context i; ... - deadline_timer t(i); - t.expires_from_now(boost::posix_time::milliseconds(400)); + steady_timer t(i); + t.expires_after(chrono::milliseconds(400)); t.async_wait(handler); ... i.run(); -The deadline associated with a timer may also be obtained as a relative time: +The deadline associated with a timer may also be obtained as an absolute time: - boost::posix_time::time_duration time_until_expiry - = t.expires_from_now(); + steady_timer::time_point time_of_expiry = t.expiry(); -or as an absolute time to allow composition of timers: +which allows composition of timers: - deadline_timer t2(i); - t2.expires_at(t.expires_at() + boost::posix_time::seconds(30)); + steady_timer t2(i); + t2.expires_at(t.expiry() + chrono::seconds(30)); [heading See Also] -[link boost_asio.reference.basic_deadline_timer basic_deadline_timer], -[link boost_asio.reference.deadline_timer deadline_timer], +[link boost_asio.reference.basic_waitable_timer basic_waitable_timer], +[link boost_asio.reference.steady_timer steady_timer], +[link boost_asio.reference.system_timer system_timer], +[link boost_asio.reference.high_resolution_timer high_resolution_timer], [link boost_asio.tutorial.tuttimer1 timer tutorials]. [endsect]