Boost C++ Libraries: Ticket #6871: chrono_io.hpp: operator<<(ostream& os, ...) modifies the state of os https://svn.boost.org/trac10/ticket/6871 <p> The code </p> <blockquote> <p> std::locale loc = os.getloc(); if (!std::has_facet&lt;Facet&gt;(loc)) </p> <blockquote> <p> os.imbue(std::locale(loc, new Facet)); </p> </blockquote> </blockquote> <p> causes the state of os to be changed. It requires the CLIENT code to do own locale saving, like in { </p> <blockquote> <p> boost::io::ios_locale_saver loc(std::cout); std::cout &lt;&lt; boost::chrono::system_clock::now() &lt;&lt; std::endl; </p> </blockquote> <p> } </p> <p> Compare this to stream io code in boost/date_time (e.g., gregorian_io.hpp), that begins with a (correct) </p> <blockquote> <p> boost::io::ios_flags_saver iflags(os); </p> </blockquote> <p> Please fix chrono to behave similarly. </p> <p> Discovered with 1.47.0 in chrono/chrono_io.hpp, but also exists on the trunk in chrono/io_v1/chrono_io.hpp. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6871 Trac 1.4.3 viboes Mon, 28 May 2012 17:07:53 GMT <link>https://svn.boost.org/trac10/ticket/6871#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6871#comment:1</guid> <description> <p> I'm reworking the chrono io for version v2 which uses ios_base states instead of locale facets. Could you check if the version 2 solves the issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 03 Jun 2012 14:04:07 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/6871#comment:2 https://svn.boost.org/trac10/ticket/6871#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket viboes Sat, 08 Sep 2012 06:52:26 GMT version, milestone changed https://svn.boost.org/trac10/ticket/6871#comment:3 https://svn.boost.org/trac10/ticket/6871#comment:3 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost Development Trunk</span> → <span class="trac-field-new">Boost 1.47.0</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.52.0</span> </li> </ul> Ticket viboes Sun, 09 Sep 2012 18:45:44 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6871#comment:4 https://svn.boost.org/trac10/ticket/6871#comment:4 <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> The issue is solved moving to version 2. You should define BOOST_CHRONO_VERSION=2. </p> <p> Merged to release <a class="changeset" href="https://svn.boost.org/trac10/changeset/80424" title="Chrono: merged from trunk chrono io V2">[80424]</a><a class="changeset" href="https://svn.boost.org/trac10/changeset/80430" title="Chrono: Added missing files">[80430]</a><a class="changeset" href="https://svn.boost.org/trac10/changeset/80471" title="Chrono: Merged from trunk 1.52">[80471]</a>. </p> Ticket viboes Sun, 16 Sep 2012 08:05:39 GMT status changed; resolution deleted https://svn.boost.org/trac10/ticket/6871#comment:5 https://svn.boost.org/trac10/ticket/6871#comment:5 <ul> <li><strong>status</strong> <span class="trac-field-old">closed</span> → <span class="trac-field-new">reopened</span> </li> <li><strong>resolution</strong> <span class="trac-field-deleted">fixed</span> </li> </ul> Ticket viboes Sun, 16 Sep 2012 08:06:44 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/6871#comment:6 https://svn.boost.org/trac10/ticket/6871#comment:6 <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">wontfix</span> </li> </ul> <p> I have no fix for io version 1. You should move to version 2. </p> Ticket