From 02817ec9f22fc5845d2b2686cac4573cda3b4062 Mon Sep 17 00:00:00 2001 From: Winfried Donkers Date: Sun, 23 Dec 2018 14:57:01 +0100 Subject: 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 (cherry picked from commit 1692034d53ce28b2c5d1c63ab429232a92b2f861) Reviewed-on: https://gerrit.libreoffice.org/66094 --- .../unit/data/functions/date_time/fods/second.fods | 91 ++++++++++++++++++++-- sc/source/core/tool/interpr2.cxx | 5 +- 2 files changed, 88 insertions(+), 8 deletions(-) (limited to 'sc') 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 @@ + + + : + + : + + @@ -527,6 +534,7 @@ + @@ -826,11 +834,11 @@ - - 12 + + 13 - - 12 + + 13 TRUE @@ -839,11 +847,80 @@ =SECOND(J9) - tdf11880 + tdf118800 + + + + 10:11:12.6000 + + + + + + 9 + + + 9 + + + TRUE + + + =SECOND(J10) + + + tdf121978 + + + + 2018-10-22 11:34:53.0000 + + + 2018-10-22 11:31:44.0000 + + + + + + 9 + + + 9 + + + TRUE + + + =SECOND(J11) + + + tdf121978 + + + + 00:00:08.9990 + + + + + + 8 + + + 8 + + + TRUE + + + =SECOND(J12) + + + tdf121978 - - 10:11:12.60 + + 00:00:08.2500 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() -- cgit v1.2.3