
Hi Folks, Here is the issue. If you have a local_date_time before the change in daylight saving time to Standard time or vice versa if you add one day to it the answer is incorrect. Here is a short example: #include "boost/date_time/local_time/local_time.hpp" #include "boost/date_time/posix_time/posix_time.hpp" #include "boost/date_time/local_time_adjustor.hpp" using namespace boost; using namespace local_time; using namespace gregorian; using namespace boost::posix_time; int main(){ typedef boost::date_time::local_adjustor<boost::posix_time::ptime, -6,boost::posix_time::us_dst> local_adj; std::string bryan_string = "CST-06:00:00CDT+01:00:00,M3.2.0/02:00:00,M11.1.0/02:00:00"; boost::local_time::time_zone_ptr tzptr(new boost::local_time::posix_time_zone(bryan_string)); boost::local_time::local_date_time fallback(local_adj::local_to_utc(ptime(date(2008,11,2), minutes(0))),tzptr); std::cout<<fallback<<std::endl; fallback+=days(1); std::cout<<fallback<<std::endl; fallback-=days(1); std::cout<<fallback<<std::endl; boost::local_time::local_date_time springahead(local_adj::local_to_utc(ptime(date(2008,3,9), minutes(0))),tzptr); std::cout<<std::endl; std::cout<<springahead<<std::endl; springahead+=days(1); std::cout<<springahead<<std::endl; springahead-=days(1); std::cout<<springahead<<std::endl; } this code produces the following output with 1.37 and 1.38 2008-Nov-02 00:00:00 CDT 2008-Nov-02 23:00:00 CST 2008-Nov-02 00:00:00 CDT 2008-Mar-09 00:00:00 CST 2008-Mar-10 01:00:00 CDT 2008-Mar-09 00:00:00 CST michael
participants (1)
-
Michael Mathews