From f6b6d222dc1a79c95f6756c707c5fcc3a785c030 Mon Sep 17 00:00:00 2001 From: "B. Stack" Date: Sun, 6 Feb 2022 16:41:53 -0500 Subject: add upstream 11.17 --- zen/format_unit.cpp | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'zen/format_unit.cpp') diff --git a/zen/format_unit.cpp b/zen/format_unit.cpp index d546124f..6803523a 100644 --- a/zen/format_unit.cpp +++ b/zen/format_unit.cpp @@ -90,14 +90,12 @@ std::wstring formatUnitTime(int val, UnitRemTime unit) { switch (unit) { - case UnitRemTime::sec: - return _P("1 sec", "%x sec", val); - case UnitRemTime::min: - return _P("1 min", "%x min", val); - case UnitRemTime::hour: - return _P("1 hour", "%x hours", val); - case UnitRemTime::day: - return _P("1 day", "%x days", val); + //*INDENT-OFF* + case UnitRemTime::sec: return _P("1 sec", "%x sec", val); + case UnitRemTime::min: return _P("1 min", "%x min", val); + case UnitRemTime::hour: return _P("1 hour", "%x hours", val); + case UnitRemTime::day: return _P("1 day", "%x days", val); + //*INDENT-ON* } assert(false); return _("Error"); @@ -152,15 +150,10 @@ std::wstring zen::formatRemainingTime(double timeInSec) } -//std::wstring zen::fractionToString1Dec(double fraction) -//{ -// return printNumber(L"%.1f", fraction * 100.0) + L'%'; //no need to internationalize fraction!? -//} - - -std::wstring zen::formatFraction(double fraction) +std::wstring zen::formatPercent0(double fraction) { - return printNumber(L"%.2f", fraction * 100.0) + L'%'; //no need to internationalize fraction!? + return numberTo(std::lround(fraction * 100)) + L'%'; //need to localize percent!? + //return printNumber(L"%.2f", fraction * 100) + L'%'; } @@ -193,7 +186,6 @@ WeekDay impl::getFirstDayOfWeekImpl() //throw SysError --------------------------------------- LC_TIME=en_DK.utf8 => Monday LC_TIME=en_US.utf8 => Sunday */ - const char* firstDay = ::nl_langinfo(_NL_TIME_FIRST_WEEKDAY); //[1-Sunday, 7-Saturday] ASSERT_SYSERROR(firstDay && 1 <= *firstDay && *firstDay <= 7); -- cgit