summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2019-01-28 13:31:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-01-29 11:02:43 +0100
commit10417db7f0b840d6494163876a73a0067b71f32e (patch)
tree3e8fea1169a121f58af047ce9ad01818e937d8c3 /svl
parent086ead82a6fe0f73c617e65c3ffc1c9930796205 (diff)
Resolves: tdf#122991 do not truncate time duration [] format values
Regression from commit e2e47898180e547cad7ccde1e5890385d573e551 CommitDate: Fri Aug 31 12:50:52 2018 +0200 Use tools::Time::GetClock() in number formatter for wall clock time This partly reverts the change for the affected time duration [] formats, which truncated the value within the magnitude that due to the imprecision of floating point values lead to "false" precision of h:m:s.999999... This might again yield imprecise display values (old behaviour) for a difference of two wall clock times that now are not rounded up into the next magnitude for display. If so, a tools::Time::GetDuration() might be appropriate. Change-Id: If8fbcc2e4c2e0da04ca742a2837f57cd313d0367 Reviewed-on: https://gerrit.libreoffice.org/67005 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 31d3369803ce4eceab5ef708f2cd33748b6d10ea) Reviewed-on: https://gerrit.libreoffice.org/67030 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zformat.cxx9
1 files changed, 1 insertions, 8 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index d9b2afc23b6e..cce16ce94e97 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -3036,14 +3036,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
}
else
{
- double fTime = fNumber * 86400.0;
- const double fOrigTime = fTime;
- const double fFullSeconds = std::trunc(fTime);
- fTime = rtl::math::round( fTime, int(nCntPost));
- // Do not round up into the next magnitude, truncate instead.
- if (fTime >= fFullSeconds + 1.0 || (fTime == 0.0 && fOrigTime != 0.0))
- fTime = rtl::math::pow10Exp( std::trunc( rtl::math::pow10Exp( fOrigTime, nCntPost)), -nCntPost);
-
+ const double fTime = rtl::math::round( fNumber * 86400.0, int(nCntPost));
if (bSign && fTime == 0.0)
{
bSign = false; // Not -00:00:00