Boost C++ Libraries: Ticket #10995: duration_put::put_value truncates fractional part https://svn.boost.org/trac10/ticket/10995 <p> For durations with a floating-point Rep type, duration_put::put_value truncates fractional part because it makes static_cast&lt;long int&gt;(d.count()). I guess this code will also be broken if Rep is unsigned long or larger integral type, causing an overflow. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10995 Trac 1.4.3 viboes Mon, 16 Feb 2015 15:05:10 GMT milestone changed https://svn.boost.org/trac10/ticket/10995#comment:1 https://svn.boost.org/trac10/ticket/10995#comment:1 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.58.0</span> </li> </ul> <p> While analyzing <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/11012" title="#11012: Bugs: chrono_io v2 fail to compile with boost::chrono::duration&lt; ... (closed: fixed)">#11012</a> I found a solution <a class="ext-link" href="https://github.com/boostorg/chrono/commit/300c0c69631de7dcc9e555bdc8ff217d9a25bb88"><span class="icon">​</span>https://github.com/boostorg/chrono/commit/300c0c69631de7dcc9e555bdc8ff217d9a25bb88</a>. </p> <p> Let me know if this works for you. </p> Ticket viboes Mon, 16 Feb 2015 15:13:07 GMT status changed https://svn.boost.org/trac10/ticket/10995#comment:2 https://svn.boost.org/trac10/ticket/10995#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket rkawulak Mon, 16 Feb 2015 23:54:40 GMT <link>https://svn.boost.org/trac10/ticket/10995#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10995#comment:3</guid> <description> <p> Seems this won't work for types narrower than int_least32_t. (And why int_least32_t in particular and not int?) I guess it would be more correct to have three SFINAE-enabled trait specialisations for all signed integral, all unsigned integral and all floating-point types, promoting them to the largest corresponding type. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Tue, 17 Feb 2015 00:30:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10995#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10995#comment:4</guid> <description> <p> Right, the issue I found is with int. </p> <p> I don't remember if there is a constraint on the representation, but IMO, it is weird to use unsigned for duration. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Mon, 09 Mar 2015 07:22:13 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10995#comment:5 https://svn.boost.org/trac10/ticket/10995#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> Ticket