Re: [Boost-bugs] [Boost C++ Libraries] #4771: DST calculation inconsistencies

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4771: DST calculation inconsistencies
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-03-19 18:20:16


#4771: DST calculation inconsistencies
-------------------------------+------------------------
  Reporter: mika.heiskanen@… | Owner: az_sw_dude
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: date_time
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
-------------------------------+------------------------

Comment (by meisenbraun@…):

 Code to expose the issue:
 {{{
 #include <boost/date_time/local_time/local_time.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <iostream>
 #include <cmath>

 int main(int argc, char** argv )
 {
     using namespace boost;
     using namespace boost::gregorian;
     using namespace boost::local_time;
     using namespace boost::posix_time;

     ptime sourceTime;
     tz_database db;
     db.load_from_file("date_time_zonespec.csv");
     time_zone_ptr localTZ = db.time_zone_from_region("America/Chicago");

     const unsigned int n = 26 * 60 +120;

     date preDST(2016,Mar,12);
     time_duration offset0 = hours(0);
     local_date_time dt0(preDST, offset0, localTZ,
 local_date_time::NOT_DATE_TIME_ON_ERROR);

     date date2 = preDST + days(std::floor(n/(24*60)));
     time_duration offset1 = minutes(n%(24*60));
     local_date_time dt1(date2, offset1, localTZ,
 local_date_time::NOT_DATE_TIME_ON_ERROR);

     time_duration offset2 = minutes(n);
     local_date_time dt2(preDST, offset2, localTZ,
 local_date_time::NOT_DATE_TIME_ON_ERROR);

     std::cout << "DT 0: " << dt0 << std::endl;
     std::cout << "DT 1: " << dt1 << std::endl; // 04:00:00 CDT reported,
 05:00:00 CDT expected
     std::cout << "DT 2: " << dt2 << std::endl; // 05:00:00 CDT reported
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4771#comment:1>
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:19 UTC