diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2018-12-23 14:57:01 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2019-01-11 01:09:28 +0100 |
commit | 02817ec9f22fc5845d2b2686cac4573cda3b4062 (patch) | |
tree | 78f7e079b2bce8f986f696b32c7a6eecb8fece29 /sc | |
parent | fe7269ade557171413f78ad7331e16fd1bde03eb (diff) |
tdf#121978 use round again for Calc function SECOND.
Round was inadvertedly replaced by floor in commit 273b3e10eab70ebc084cb62568bd699fddfb376e.
Change-Id: Ie0824e228c62509952a11b866638482a409c851d
Reviewed-on: https://gerrit.libreoffice.org/65579
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 1692034d53ce28b2c5d1c63ab429232a92b2f861)
Reviewed-on: https://gerrit.libreoffice.org/66094
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/functions/date_time/fods/second.fods | 91 | ||||
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 5 |
2 files changed, 88 insertions, 8 deletions
diff --git a/sc/qa/unit/data/functions/date_time/fods/second.fods b/sc/qa/unit/data/functions/date_time/fods/second.fods index 8db288ae3ae9..fbeda46f4841 100644 --- a/sc/qa/unit/data/functions/date_time/fods/second.fods +++ b/sc/qa/unit/data/functions/date_time/fods/second.fods @@ -342,6 +342,13 @@ <number:number-style style:name="N143"> <number:number number:decimal-places="18" loext:min-decimal-places="18" number:min-integer-digits="1"/> </number:number-style> + <number:time-style style:name="N145"> + <number:hours number:style="long"/> + <number:text>:</number:text> + <number:minutes number:style="long"/> + <number:text>:</number:text> + <number:seconds number:style="long" number:decimal-places="4"/> + </number:time-style> <style:style style:name="Default" style:family="table-cell"> <style:text-properties style:font-name-asian="Droid Sans Fallback" style:font-family-asian="'Droid Sans Fallback'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-name-complex="Droid Sans Devanagari" style:font-family-complex="'Droid Sans Devanagari'" style:font-family-generic-complex="system" style:font-pitch-complex="variable"/> </style:style> @@ -527,6 +534,7 @@ <style:style style:name="ce19" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N41"/> <style:style style:name="ce20" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N51"/> <style:style style:name="ce21" style:family="table-cell" style:parent-style-name="Default"> + <style:style style:name="ce46" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N145"/> <style:text-properties style:use-window-font-color="true" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Courier New" fo:font-size="10pt" fo:language="en" fo:country="US" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:text-underline-mode="continuous" style:text-overline-mode="continuous" style:text-line-through-mode="continuous" style:font-size-asian="10pt" style:language-asian="en" style:country-asian="US" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-size-complex="10pt" style:language-complex="en" style:country-complex="US" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/> </style:style> <style:style style:name="ce22" style:family="table-cell" style:parent-style-name="Default"> @@ -826,11 +834,11 @@ <table:table-cell table:number-columns-repeated="5"/> </table:table-row> <table:table-row table:style-name="ro2"> - <table:table-cell table:formula="of:=SECOND([.J9])" office:value-type="float" office:value="12" calcext:value-type="float"> - <text:p>12</text:p> + <table:table-cell table:formula="of:=SECOND([.J9])" office:value-type="float" office:value="13" calcext:value-type="float"> + <text:p>13</text:p> </table:table-cell> - <table:table-cell office:value-type="float" office:value="12" calcext:value-type="float"> - <text:p>12</text:p> + <table:table-cell office:value-type="float" office:value="13" calcext:value-type="float"> + <text:p>13</text:p> </table:table-cell> <table:table-cell table:style-name="ce38" table:formula="of:=[.A9]=[.B9]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>TRUE</text:p> @@ -839,11 +847,80 @@ <text:p>=SECOND(J9)</text:p> </table:table-cell> <table:table-cell office:value-type="string" calcext:value-type="string"> - <text:p>tdf11880</text:p> + <text:p>tdf118800</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="4"/> + <table:table-cell table:style-name="ce46" office:value-type="time" office:time-value="PT10H11M12.6000S" calcext:value-type="time"> + <text:p>10:11:12.6000</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:formula="of:=SECOND([.J10]-[.K10])" office:value-type="float" office:value="9" calcext:value-type="float"> + <text:p>9</text:p> + </table:table-cell> + <table:table-cell office:value-type="float" office:value="9" calcext:value-type="float"> + <text:p>9</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce38" table:formula="of:=[.A10]=[.B10]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A10])" office:value-type="string" office:string-value="=SECOND(J10)" calcext:value-type="string"> + <text:p>=SECOND(J10)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>tdf121978</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="4"/> + <table:table-cell table:style-name="ce20" office:value-type="date" office:date-value="2018-10-22T11:34:53" calcext:value-type="date"> + <text:p>2018-10-22 11:34:53.0000</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce20" office:value-type="date" office:date-value="2018-10-22T11:31:44" calcext:value-type="date"> + <text:p>2018-10-22 11:31:44.0000</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:formula="of:=SECOND([.J11])" office:value-type="float" office:value="9" calcext:value-type="float"> + <text:p>9</text:p> + </table:table-cell> + <table:table-cell office:value-type="float" office:value="9" calcext:value-type="float"> + <text:p>9</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce38" table:formula="of:=[.A11]=[.B11]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A11])" office:value-type="string" office:string-value="=SECOND(J11)" calcext:value-type="string"> + <text:p>=SECOND(J11)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>tdf121978</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="4"/> + <table:table-cell table:style-name="ce46" office:value-type="time" office:time-value="PT00H00M08.999S" calcext:value-type="time"> + <text:p>00:00:08.9990</text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="5"/> + </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:formula="of:=SECOND([.J12])" office:value-type="float" office:value="8" calcext:value-type="float"> + <text:p>8</text:p> + </table:table-cell> + <table:table-cell office:value-type="float" office:value="8" calcext:value-type="float"> + <text:p>8</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce38" table:formula="of:=[.A12]=[.B12]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p>TRUE</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce11" table:formula="of:=FORMULA([.A12])" office:value-type="string" office:string-value="=SECOND(J12)" calcext:value-type="string"> + <text:p>=SECOND(J12)</text:p> + </table:table-cell> + <table:table-cell office:value-type="string" calcext:value-type="string"> + <text:p>tdf121978</text:p> </table:table-cell> <table:table-cell table:number-columns-repeated="4"/> - <table:table-cell table:style-name="ce45" office:value-type="time" office:time-value="PT10H11M12.6S" calcext:value-type="time"> - <text:p>10:11:12.60</text:p> + <table:table-cell table:style-name="ce46" office:value-type="time" office:time-value="PT00H00M08.25S" calcext:value-type="time"> + <text:p>00:00:08.2500</text:p> </table:table-cell> <table:table-cell table:number-columns-repeated="5"/> </table:table-row> diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index c151000f34e1..b122d0e4f706 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -156,7 +156,10 @@ void ScInterpreter::ScGetSec() sal_uInt16 nHour, nMinute, nSecond; double fFractionOfSecond; tools::Time::GetClock( GetDouble(), nHour, nMinute, nSecond, fFractionOfSecond, 0); - PushDouble( nSecond); + if ( fFractionOfSecond >= 0.5 ) + nSecond = ( nSecond + 1 ) % 60; + PushDouble( nSecond ); + } void ScInterpreter::ScGetHour() |