diff options
author | Eike Rathke <erack@redhat.com> | 2022-10-24 17:06:09 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-10-24 20:28:50 +0200 |
commit | c3247f0380b4ffe90672a0442687593531c5774b (patch) | |
tree | d28d462492dccd013a36d1644168ee2c64b51175 /svl | |
parent | 6d4e290bfd38664eebb1a394563e89a845a85078 (diff) |
Use constexpr kTimeSignificantRound for all occurrences
Change-Id: I3d55c5ee0d0e7a803f95c0fe9f67ee15fe814b65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141773
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zformat.cxx | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index b3a547c28d3f..4aa5543ed5d3 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -62,6 +62,8 @@ const double EXP_ABS_UPPER_BOUND = 1.0E15; // use exponential notation above th // also sal/rtl/math.cxx // doubleToString() +constexpr sal_Int32 kTimeSignificantRound = 7; // Round (date+)time at 7 decimals + // (+5 of 86400 == 12 significant digits). } // namespace const double D_MAX_U_INT32 = double(0xffffffff); // 4294967295.0 @@ -3069,10 +3071,10 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, bool bInputLine; sal_Int32 nCntPost; if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION && - 0 < rInfo.nCntPost && rInfo.nCntPost < 7 ) - { // round at 7 decimals (+5 of 86400 == 12 significant digits) + 0 < rInfo.nCntPost && rInfo.nCntPost < kTimeSignificantRound ) + { bInputLine = true; - nCntPost = 7; + nCntPost = kTimeSignificantRound; } else { @@ -3954,20 +3956,18 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); bool bInputLine; sal_Int32 nCntPost, nFirstRounding; - // Round at 7 decimals (+5 of 86400 == 12 significant digits). - constexpr sal_Int32 kSignificantRound = 7; if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION && - 0 < rInfo.nCntPost && rInfo.nCntPost < kSignificantRound ) + 0 < rInfo.nCntPost && rInfo.nCntPost < kTimeSignificantRound ) { bInputLine = true; - nCntPost = nFirstRounding = kSignificantRound; + nCntPost = nFirstRounding = kTimeSignificantRound; } else { bInputLine = false; nCntPost = rInfo.nCntPost; // For clock format (not []) do not round up to seconds and thus days. - nFirstRounding = (rInfo.bThousand ? nCntPost : kSignificantRound); + nFirstRounding = (rInfo.bThousand ? nCntPost : kTimeSignificantRound); } double fTime = (fNumber - floor( fNumber )) * 86400.0; fTime = ::rtl::math::round( fTime, int(nFirstRounding) ); |