Subject: [Boost-bugs] [Boost C++ Libraries] #3109: time_duration::total_seconds() - overflow
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-05-29 14:30:21
#3109: time_duration::total_seconds() - overflow
-------------------------------+--------------------------------------------
Reporter: ioni_at_[hidden] | Owner: az_sw_dude
Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
Version: Boost 1.39.0 | Severity: Problem
Keywords: year 2038 problem |
-------------------------------+--------------------------------------------
time_duration::total_seconds() overflow value
minimal sample (based on boost example)
//////////////////////////////////////////////////////////////
#include <string>
#include <boost/date_time/local_time/local_time.hpp>
int main()
{
using namespace boost::gregorian;
using namespace boost::local_time;
using namespace boost::posix_time;
date in_date(2039, 10, 04);
time_duration td(12,14,32);
std::string z("PST-8PDT,M4.1.0,M10.1.0");
time_zone_ptr zone(new posix_time_zone(z));
local_date_time my_time(in_date, td, zone,
local_date_time::NOT_DATE_TIME_ON_ERROR);
std::cout << my_time << std::endl;
//
ptime time_t_epoch( date(1970,1,1) );
std::cout << time_t_epoch << std::endl;
//
time_duration diff = my_time.utc_time() - time_t_epoch;
std::cout << "Seconds diff: " << diff.total_seconds() << std::endl;
return 0;
}
//////////////////////////////////////////////////////////////
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3109> 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