[Boost-bugs] [Boost C++ Libraries] #12214: boost::posix_time::time_duration::sec_type is too small!

Subject: [Boost-bugs] [Boost C++ Libraries] #12214: boost::posix_time::time_duration::sec_type is too small!
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-05-18 12:37:08


#12214: boost::posix_time::time_duration::sec_type is too small!
------------------------------+------------------------
 Reporter: anonymous | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.61.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 This code:

 sec_type total_seconds() const
 {
   return static_cast<sec_type>(ticks() / ticks_per_second());
 }

 is unsafe as sec_type is int32_t while ticks() is int64_t.

 See this post for an easy way to have inconsistent result when using
 boost::posix_time::time_duration::total_seconds().

 sec_type should be enlarged to int64_t

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12214>
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:20 UTC