Kaydet (Commit) 609ea85b authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#123748 do not strip date part before calling Time::GetClock()

GetClock() needs it to properly scale and round the floating point
value. It also handles negative values, fiddling with that is only
needed for the [] formats.

Regression from

    commit e2e47898
    CommitDate: Fri Aug 31 12:50:52 2018 +0200

        Use tools::Time::GetClock() in number formatter for wall clock time

Change-Id: I05fe9e22886d4e59f110c0a826dadb43234d348a
Reviewed-on: https://gerrit.libreoffice.org/68508Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: Jenkins
üst 2538dc89
...@@ -3000,7 +3000,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, ...@@ -3000,7 +3000,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
{ {
using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::i18n;
bool bCalendarSet = false; bool bCalendarSet = false;
double fNumberOrig = fNumber; const double fNumberOrig = fNumber;
bool bRes = false; bool bRes = false;
bool bSign = false; bool bSign = false;
if (fNumber < 0.0) if (fNumber < 0.0)
...@@ -3020,10 +3020,6 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, ...@@ -3020,10 +3020,6 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
return false; return false;
} }
} }
else
{
fNumber -= floor(fNumber); // Else truncate date
}
bool bInputLine; bool bInputLine;
sal_Int32 nCntPost; sal_Int32 nCntPost;
if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION && if ( rScan.GetStandardPrec() == SvNumberFormatter::INPUTSTRING_PRECISION &&
...@@ -3037,10 +3033,6 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, ...@@ -3037,10 +3033,6 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
bInputLine = false; bInputLine = false;
nCntPost = rInfo.nCntPost; nCntPost = rInfo.nCntPost;
} }
if (bSign && !rInfo.bThousand) // No [] format
{
fNumber = 1.0 - fNumber; // "Inverse"
}
OUStringBuffer sSecStr; OUStringBuffer sSecStr;
sal_Int32 nSecPos = 0; // For figure by figure processing sal_Int32 nSecPos = 0; // For figure by figure processing
...@@ -3049,7 +3041,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber, ...@@ -3049,7 +3041,7 @@ bool SvNumberformat::ImpGetTimeOutput(double fNumber,
{ {
sal_uInt16 nCHour, nCMinute, nCSecond; sal_uInt16 nCHour, nCMinute, nCSecond;
double fFractionOfSecond; double fFractionOfSecond;
tools::Time::GetClock( fNumber, nCHour, nCMinute, nCSecond, fFractionOfSecond, nCntPost); tools::Time::GetClock( fNumberOrig, nCHour, nCMinute, nCSecond, fFractionOfSecond, nCntPost);
nHour = nCHour; nHour = nCHour;
nMin = nCMinute; nMin = nCMinute;
nSec = nCSecond; nSec = nCSecond;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment