Re: [Boost-bugs] [Boost C++ Libraries] #4543: ptime: year 2038 problem

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4543: ptime: year 2038 problem
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-09-16 13:56:33


#4543: ptime: year 2038 problem
------------------------------------+------------------------
  Reporter: Roland Bock <rbock@…> | Owner: az_sw_dude
      Type: Bugs | Status: assigned
 Milestone: | Component: date_time
   Version: Boost 1.44.0 | Severity: Problem
Resolution: | Keywords:
------------------------------------+------------------------

Comment (by Jim King <jim.king@…>):

 I found that in time_resolution_traits the variable type being used is a
 boost::int32_t. I changed this to std::time_t and the problems went away.
 This did require rebuilding some things. I was able to simplify to_time_t
 and from_time_t down to:
 {{{
   //! Function that converts a time_t into a ptime.
   inline
   ptime from_time_t(std::time_t t)
   {
     return ptime(gregorian::date(1970,1,1)) + seconds(t);
   }

   //! Function that converts a ptime into a time_t
   inline
   std::time_t to_time_t(const ptime& pt)
   {
     return (pt - ptime(gregorian::date(1970,1,1))).total_seconds();
   }
 }}}
 What I am uncertain of is the effect this has on any backwards
 compatibility or i/o conversions for streaming. Thoughts?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4543#comment:5>
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