Boost C++ Libraries: Ticket #3312: boost::asio::deadline_timer.expires_from_now() ignores local time https://svn.boost.org/trac10/ticket/3312 <p> The <code>expire_from_now()</code> method assumes that 'now' is UTC time which is completely discouraging. </p> <p> Consider the following sample program: </p> <pre class="wiki">#include &lt;iostream&gt; #include &lt;boost/asio.hpp&gt; #include &lt;boost/date_time/posix_time/posix_time.hpp&gt; int main(int argc, const char* argv[]) { using namespace std; using namespace boost::asio; using namespace boost::posix_time; io_service service; deadline_timer timer(service); cout &lt;&lt; "current UTC time is '" &lt;&lt; to_simple_string(microsec_clock::universal_time()) &lt;&lt; "'" &lt;&lt; endl; cout &lt;&lt; "current local time is '" &lt;&lt; to_simple_string(microsec_clock::local_time()) &lt;&lt; "'" &lt;&lt; endl; timer.expires_from_now(minutes(1)); cout &lt;&lt; "timer is set to expire at '" &lt;&lt; to_simple_string(timer.expires_at()) &lt;&lt; "'" &lt;&lt; endl; return 0; }; </pre><p> It produces the follwing output: </p> <pre class="wiki">current UTC time is '2009-Aug-03 12:11:41.775770' current local time is '2009-Aug-03 19:11:41.782770' timer is set to expire at '2009-Aug-03 12:12:41.791770' </pre><p> I believe the output should be: </p> <pre class="wiki">current UTC time is '2009-Aug-03 12:11:41.775770' current local time is '2009-Aug-03 19:11:41.782770' timer is set to expire at '2009-Aug-03 19:12:41.791770' </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3312 Trac 1.4.3 chris_kohlhoff Tue, 12 Jan 2010 22:38:15 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3312#comment:1 https://svn.boost.org/trac10/ticket/3312#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> The deadline_timer typedef is based on a UTC clock, and all operations (expires_at, expires_from_now) work in UTC time. If you want it to use a different clock (such as the local time clock), you can use basic_deadline_timer&lt;&gt; with your own traits class. Please see the "Timers" example. </p> Ticket