From 7f1a71156745e57e9a2ca2b5a2369ce27d6ce227 Mon Sep 17 00:00:00 2001 From: YOSHINO Yoshihito Date: Sat, 22 Dec 2018 01:03:49 +0100 Subject: [PATCH] Bug 796989 - some date/time does not honor user locale because now it looks for the user locale each time when it formats datetime, I added Fixme comments. --- libgnucash/engine/gnc-datetime.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libgnucash/engine/gnc-datetime.cpp b/libgnucash/engine/gnc-datetime.cpp index 8561cb0ac6..f5d99167ba 100644 --- a/libgnucash/engine/gnc-datetime.cpp +++ b/libgnucash/engine/gnc-datetime.cpp @@ -428,7 +428,8 @@ GncDateTimeImpl::format(const char* format) const std::stringstream ss; //The stream destructor frees the facet, so it must be heap-allocated. auto output_facet(new Facet(normalize_format(format).c_str())); - ss.imbue(std::locale(std::locale(), output_facet)); + // FIXME Rather than imbueing a locale below we probably should set std::locale::global appropriately somewhere. + ss.imbue(std::locale(std::locale(""), output_facet)); ss << m_time; return ss.str(); } @@ -439,8 +440,9 @@ GncDateTimeImpl::format_zulu(const char* format) const using Facet = boost::posix_time::time_facet; std::stringstream ss; //The stream destructor frees the facet, so it must be heap-allocated. - auto output_facet(new Facet(normalize_format(format).c_str())); - ss.imbue(std::locale(std::locale(), output_facet)); + auto output_facet(new Facet(normalize_format(format).c_str())); + // FIXME Rather than imbueing a locale below we probably should set std::locale::global appropriately somewhere. + ss.imbue(std::locale(std::locale(""), output_facet)); ss << m_time.utc_time(); return ss.str(); } @@ -499,7 +501,8 @@ GncDateImpl::format(const char* format) const std::stringstream ss; //The stream destructor frees the facet, so it must be heap-allocated. auto output_facet(new Facet(normalize_format(format).c_str())); - ss.imbue(std::locale(std::locale(), output_facet)); + // FIXME Rather than imbueing a locale below we probably should set std::locale::global appropriately somewhere. + ss.imbue(std::locale(std::locale(""), output_facet)); ss << m_greg; return ss.str(); }