Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75329 - trunk/boost/chrono/io
From: vicente.botet_at_[hidden]
Date: 2011-11-05 18:07:04


Author: viboes
Date: 2011-11-05 18:07:04 EDT (Sat, 05 Nov 2011)
New Revision: 75329
URL: http://svn.boost.org/trac/boost/changeset/75329

Log:
Chrono: Fix error in time ios state savers
Text files modified:
   trunk/boost/chrono/io/time_point_io.hpp | 22 ++++------------------
   1 files changed, 4 insertions(+), 18 deletions(-)

Modified: trunk/boost/chrono/io/time_point_io.hpp
==============================================================================
--- trunk/boost/chrono/io/time_point_io.hpp (original)
+++ trunk/boost/chrono/io/time_point_io.hpp 2011-11-05 18:07:04 EDT (Sat, 05 Nov 2011)
@@ -265,15 +265,8 @@
        * Store a reference to the i/o stream and the value of the associated @c time format .
        */
       explicit time_fmt_io_saver(state_type &s) :
- s_save_(s)
+ s_save_(s), a_save_(get_time_fmt(s_save_))
       {
- typedef duration_punct<CharT> Facet;
- std::locale loc = s_save_.getloc();
- if (!std::has_facet<Facet>(loc))
- s_save_.imbue(std::locale(loc, new Facet()));
-
- const Facet& f = std::use_facet<Facet>(s_save_.getloc());
- a_save_ = f.get_duration_style();
       }
 
       /**
@@ -301,7 +294,7 @@
        */
       void restore()
       {
- s_save_ << time_fmt(a_save_);
+ set_time_fmt(a_save_, a_save_);
       }
     private:
       state_type& s_save_;
@@ -328,15 +321,8 @@
        * Store a reference to the i/o stream and the value of the associated @c timezone.
        */
       explicit timezone_io_saver(state_type &s) :
- s_save_(s)
+ s_save_(s), a_save_(get_timezone(s_save_))
       {
- typedef duration_punct<CharT> Facet;
- std::locale loc = s_save_.getloc();
- if (!std::has_facet<Facet>(loc))
- s_save_.imbue(std::locale(loc, new Facet()));
-
- const Facet& f = std::use_facet<Facet>(s_save_.getloc());
- a_save_ = f.get_duration_style();
       }
 
       /**
@@ -364,7 +350,7 @@
        */
       void restore()
       {
- s_save_ << time_fmt(a_save_);
+ set_timezone(s_save_, a_save_);
       }
     private:
       state_type& s_save_;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk