[Boost-bugs] [Boost C++ Libraries] #2819: boost::posix_time::hours, minutes, and seconds assume sizeof(long) == sizeof(int)

Subject: [Boost-bugs] [Boost C++ Libraries] #2819: boost::posix_time::hours, minutes, and seconds assume sizeof(long) == sizeof(int)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-03-02 22:55:17


#2819: boost::posix_time::hours, minutes, and seconds assume sizeof(long) ==
sizeof(int)
----------------------------------+-----------------------------------------
 Reporter: pelee_at_[hidden] | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: date_time
  Version: Boost Release Branch | Severity: Problem
 Keywords: |
----------------------------------+-----------------------------------------
 The constructors for boost::posix_time::hours, minutes, and seconds take
 arguments of type long, which is 64 bits on 64 bit LP64 environments like
 MacOS 10.5. This leads to warnings about possible truncation when these
 arguments are passed to the constructor for time_duration. Since
 time_duration is a template class that can be instantiated for different
 types, boost::sint32_t seems like a safer type to use in the non-templated
 constructors in boost::posix_time than a compiler-specific type like long.


 {{{
   //! Allows expression of durations as an hour count
   /*! \ingroup time_basics
    */
   class hours : public time_duration
   {
   public:
           explicit hours(boost::int32_t h) :
       time_duration(h,0,0)
     {}
   };

   //! Allows expression of durations as a minute count
   /*! \ingroup time_basics
    */
   class minutes : public time_duration
   {
   public:
           explicit minutes(boost::int32_t m) :
       time_duration(0,m,0)
     {}
   };

   //! Allows expression of durations as a seconds count
   /*! \ingroup time_basics
    */
   class seconds : public time_duration
   {
   public:
           explicit seconds(boost::int32_t s) :
       time_duration(0,0,s)
     {}
   };
 }}}

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