[Boost-bugs] [Boost C++ Libraries] #3312: boost::asio::deadline_timer.expires_from_now() ignores local time

Subject: [Boost-bugs] [Boost C++ Libraries] #3312: boost::asio::deadline_timer.expires_from_now() ignores local time
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-08-03 12:16:21


#3312: boost::asio::deadline_timer.expires_from_now() ignores local time
-----------------------------------------+----------------------------------
 Reporter: victor.v.lukashov@… | Owner: chris_kohlhoff
     Type: Bugs | Status: new
Milestone: Boost 1.40.0 | Component: asio
  Version: Boost 1.39.0 | Severity: Problem
 Keywords: |
-----------------------------------------+----------------------------------
 The {{{expire_from_now()}}} method assumes that 'now' is UTC time which is
 completely discouraging.

 Consider the following sample program:
 {{{
 #include <iostream>
 #include <boost/asio.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>

 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 << "current UTC time is '" <<
 to_simple_string(microsec_clock::universal_time()) << "'" << endl;
         cout << "current local time is '" <<
 to_simple_string(microsec_clock::local_time()) << "'" << endl;
         timer.expires_from_now(minutes(1));
         cout << "timer is set to expire at '" <<
 to_simple_string(timer.expires_at()) << "'" << endl;

         return 0;
 };
 }}}

 It produces the follwing output:
 {{{
 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'
 }}}

 I believe the output should be:
 {{{
 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'
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3312>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC