diff options
Diffstat (limited to 'boost/date_time/date_formatting_locales.hpp')
-rw-r--r-- | boost/date_time/date_formatting_locales.hpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/boost/date_time/date_formatting_locales.hpp b/boost/date_time/date_formatting_locales.hpp index 2c17c055cd..a1daad33ae 100644 --- a/boost/date_time/date_formatting_locales.hpp +++ b/boost/date_time/date_formatting_locales.hpp @@ -17,6 +17,7 @@ #include "boost/date_time/iso_format.hpp" #include "boost/date_time/date_names_put.hpp" #include "boost/date_time/parse_format_base.hpp" +#include <boost/io/ios_state.hpp> //#include <string> #include <sstream> #include <iomanip> @@ -56,8 +57,8 @@ namespace date_time { } case month_as_integer: { - charT fill_char = '0'; - os << std::setw(2) << std::setfill(fill_char) << month.as_number(); + boost::io::basic_ios_fill_saver<charT> ifs(os); + os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number(); break; } @@ -132,8 +133,8 @@ namespace date_time { ostream_type& os, const facet_type& f) { + boost::io::basic_ios_fill_saver<charT> ifs(os); std::ostreambuf_iterator<charT> oitr(os); - charT fill_char = '0'; switch (f.date_order()) { case ymd_order_iso: { os << ymd.year; @@ -144,7 +145,7 @@ namespace date_time { if (f.has_date_sep_chars()) { f.day_sep_char(oitr); } - os << std::setw(2) << std::setfill(fill_char) + os << std::setw(2) << std::setfill(os.widen('0')) << ymd.day; break; } @@ -153,7 +154,7 @@ namespace date_time { if (f.has_date_sep_chars()) { f.day_sep_char(oitr); } - os << std::setw(2) << std::setfill(fill_char) + os << std::setw(2) << std::setfill(os.widen('0')) << ymd.day; if (f.has_date_sep_chars()) { f.month_sep_char(oitr); @@ -162,7 +163,7 @@ namespace date_time { break; } case ymd_order_dmy: { - os << std::setw(2) << std::setfill(fill_char) + os << std::setw(2) << std::setfill(os.widen('0')) << ymd.day; if (f.has_date_sep_chars()) { f.day_sep_char(oitr); |