Boost C++ Libraries: Ticket #1861: time_duration type can not be correctly written or read of the period spans 24 hours of more (vc9 and probably others). https://svn.boost.org/trac10/ticket/1861 <p> Currently date_time library uses time_put::put (that delegates to strftime) in a non portable way passing it a tm structure with tm_hour field with values outside 0-23 range. See ISO 14882-2003 22.2.5.3.1 par. 1 and ISO 9899-1999 7.23.3.5 par. 3. </p> <p> The issue was already discussed on the Boost mailing list: <a class="ext-link" href="http://lists.boost.org/Archives/boost/2007/12/131541.php"><span class="icon">​</span>http://lists.boost.org/Archives/boost/2007/12/131541.php</a> </p> <p> This patch makes boost::date_time::time_facet::put(... , time_duration_type) output %H itself. As well as modifies boost::date_time::time_input_facet::get(... , time_duration_type) to input %H field as a variable length integer. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1861 Trac 1.4.3 ilya@… Thu, 24 Apr 2008 20:44:14 GMT attachment set https://svn.boost.org/trac10/ticket/1861 https://svn.boost.org/trac10/ticket/1861 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">time_facet.hpp.patch</span> </li> </ul> Ticket Andrey Semashev Thu, 13 Nov 2008 17:49:49 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1861#comment:1 https://svn.boost.org/trac10/ticket/1861#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> The proposed fix breaks IO for ISO-formatted dates, so %H is still limited to be 2 chars long. The new %O placeholder was added in order to format even longer durations. </p> Ticket ilya.bobir@… Wed, 11 Mar 2009 21:10:57 GMT attachment set https://svn.boost.org/trac10/ticket/1861 https://svn.boost.org/trac10/ticket/1861 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">date_time_long_hours_patch2.patch</span> </li> </ul> Ticket ilya.bobir@… Wed, 11 Mar 2009 21:13:55 GMT status, version changed; cc set; resolution deleted https://svn.boost.org/trac10/ticket/1861#comment:2 https://svn.boost.org/trac10/ticket/1861#comment:2 <ul> <li><strong>cc</strong> <span class="trac-author">ilya.bobir@…</span> added </li> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>version</strong> <span class="trac-field-old">Boost Development Trunk</span> → <span class="trac-field-new">Boost 1.38.0</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> <p> I think that the default format for the time_duration should be changed to contain %O instead of %H as time_duration objects can by default contain unrestricted hours value. This change affects time_duration input and output only. </p> <p> I've wrote tests in order to catch bugs with time_period objects not been capable of processing values that are longer then 24 hours. </p> <p> One of the tests showed a bug in the boost/date_time/format_date_parser.hpp:var_string_to_int(). The function was able to read after the input data end in some cases. </p> <p> All of these are contained in the patch (date_time_long_hours_patch2.patch): </p> <ol><li> The default time_duration format value is changed to %O:%M:%S%F instead of %H:%M:%S%F. </li><li> A number of tests added that deal with time_duration values longer then 24 hours. </li><li> Bug in the boost/date_time/format_date_parser.hpp:var_string_to_int() fixed. </li><li> Documentation changes. Default format specifications for time_duration updated. And the %H should probably be documented along with %O. </li></ol><p> I think that 1 and 2 are definitely a continuation of the original bug thus I decided to reopen it instead of creating a new one. </p> <p> The diff is against the 1.38.0 but the relevant files are identical to those in trunk at the moment. </p> Ticket Andrey Semashev Sun, 31 May 2009 12:17:03 GMT <link>https://svn.boost.org/trac10/ticket/1861#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1861#comment:3</guid> <description> <p> I've applied fix for var_string_to_int to trunk. When the tests pass I'll merge it to the release branch. </p> <p> As for duration default format change, this is a breaking change. Although it has a valid point, I'm not sure the change is justified enough. This has to be discussed on the ML. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Thu, 04 Jun 2009 08:42:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1861#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1861#comment:4</guid> <description> <p> The fix for var_string_to_int merged into the release branch in revision 53618 (will be released in 1.40). </p> </description> <category>Ticket</category> </item> <item> <author>Ilya Bobir <ilya.bobir@…></author> <pubDate>Thu, 23 Jul 2009 10:02:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1861#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1861#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/1861#comment:3" title="Comment 3">andysem</a>: </p> <blockquote class="citation"> <p> As for duration default format change, this is a breaking change. Although it has a valid point, I'm not sure the change is justified enough. This has to be discussed on the ML. </p> </blockquote> <p> It seems that no one cares about this change, except for Rutger ter Borg (<a class="ext-link" href="http://lists.boost.org/Archives/boost/2009/06/153112.php"><span class="icon">​</span>http://lists.boost.org/Archives/boost/2009/06/153112.php</a>) who says the current behavior is broken. The only person except you and me who also replied on the thread was Stewart, Robert but he was talking about unrelated things like error handling for IO streams in general (<a class="ext-link" href="http://lists.boost.org/Archives/boost/2009/06/152121.php"><span class="icon">​</span>http://lists.boost.org/Archives/boost/2009/06/152121.php</a>). </p> <p> Do you think the fix can be applied now? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Thu, 01 Oct 2009 20:19:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1861#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1861#comment:6</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/56506" title="Refs #1861. Changed the default format for time durations to ...">[56506]</a>) Refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1861" title="#1861: Patches: time_duration type can not be correctly written or read of the period ... (closed: fixed)">#1861</a>. Changed the default format for time durations to "%-%O:%M:%S%F" instead of "%-%H:%M:%S%F". </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Sat, 03 Oct 2009 10:04:01 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1861#comment:7 https://svn.boost.org/trac10/ticket/1861#comment:7 <ul> <li><strong>status</strong> <span class="trac-field-old">reopened</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/56545" title="Fixes #1861, #2213 merged from trunk.">[56545]</a>) Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1861" title="#1861: Patches: time_duration type can not be correctly written or read of the period ... (closed: fixed)">#1861</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2213" title="#2213: Bugs: timezone base offset range to small (closed: fixed)">#2213</a> merged from trunk. </p> Ticket