Boost C++ Libraries: Ticket #3487: using 32bit seconds type in boost::posix_time::time_duration is leading to year 2038 problem https://svn.boost.org/trac10/ticket/3487 <p> In the template class time_resolution_traits the dafault seconds type is boost::int32_t. This type is also used in the posix_time::time_duration class. </p> <p> When using posix_time::from_time_t() the time_t value (normally a 64bit type on modern systems) is casted into an boost::int32_t value. So time_t values describing times after year 2038 will not processed correctly. </p> <p> Is it possible to use boost::int64_t as default seconds type? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3487 Trac 1.4.3 anonymous Mon, 22 Nov 2010 10:59:05 GMT version, severity, milestone changed https://svn.boost.org/trac10/ticket/3487#comment:1 https://svn.boost.org/trac10/ticket/3487#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost 1.46.0</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Problem</span> → <span class="trac-field-new">Showstopper</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.41.0</span> → <span class="trac-field-new">Boost-1.46.0</span> </li> </ul> <p> I just stumbled over the same thing when trying to use a boost::posix_time::microseconds() which during the way to a 64bit value will be garbled by calculations around time_resolution_traits because the integer argument is int32_t per default. </p> <p> I would recommend that you take from the first traits parameter (that is used with the structs time_resolution_traits_adapted64_impl) in date_time/time_resolution_traits.hpp class time_resolution traits instead of </p> <p> typename v_type = boost::int32_t </p> <p> you better use </p> <p> typename v_type = typename frac_sec_type::int_type </p> <p> since in the end the _res structs are correctly defined as </p> <p> typedef time_resolution_traits&lt;time_resolution_traits_adapted64_impl, nano, 1000000000, 9 &gt; nano_res; </p> <p> which would make the 64bit value properly appear. </p> <p> Otherwise this all is unusable for us since we work with microseconds and nonoseconds since epoch timestamps on wire. </p> Ticket Vicente Botet <vicente.botet@…> Tue, 07 Dec 2010 20:53:36 GMT <link>https://svn.boost.org/trac10/ticket/3487#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3487#comment:2</guid> <description> <p> Why do you consider this ticket a showstopper? </p> </description> <category>Ticket</category> </item> <item> <author>dopiera@…</author> <pubDate>Fri, 13 Apr 2012 14:20:47 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3487#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3487#comment:3</guid> <description> <p> This also makes it impossible to use condition::timed_wait(lock_type&amp; m,boost::xtime const&amp; wait_until). </p> <p> The conversion to time_duration causes an overflow. Apart from that, I've noticed that xtime_get() and xtime_cmp() are broken too (return int). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>James E. King, III</dc:creator> <pubDate>Thu, 18 Jan 2018 14:13:15 GMT</pubDate> <title>owner, status, milestone changed https://svn.boost.org/trac10/ticket/3487#comment:4 https://svn.boost.org/trac10/ticket/3487#comment:4 <ul> <li><strong>owner</strong> changed from <span class="trac-author">az_sw_dude</span> to <span class="trac-author">James E. King, III</span> </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.46.0</span> → <span class="trac-field-new">Boost 1.67.0</span> </li> </ul> <p> This was fixed in github issue 56: </p> <p> <a class="ext-link" href="https://github.com/boostorg/date_time/commit/2e4a3010f0b159b0f40378618d717522ff9e257f#diff-c68588b074fe6450f9ed1dedc759621eR94"><span class="icon">​</span>https://github.com/boostorg/date_time/commit/2e4a3010f0b159b0f40378618d717522ff9e257f#diff-c68588b074fe6450f9ed1dedc759621eR94</a> </p> Ticket James E. King, III Sun, 28 Jan 2018 16:23:10 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3487#comment:5 https://svn.boost.org/trac10/ticket/3487#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fix merged to master; resolved. </p> Ticket