summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-08-28 11:41:37 +0200
committerEike Rathke <erack@redhat.com>2018-08-28 12:49:39 +0200
commit98cb91686901dc0133c5c23dc5658d9623dbd436 (patch)
tree036eec5fa3eb69488d0a8dc4bf0265a27c331a49
parentb88da9b4302fa324f061a4a26ab4b2d647fdc765 (diff)
Shortcut small negative values to 0:0:0, tdf#119533 tdf#118800 follow-up
... instead of letting them end up as 24:0:0 Change-Id: I0212a2b422a931a24fd2748aa2826a5b60d2a397 Reviewed-on: https://gerrit.libreoffice.org/59699 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/core/tool/interpr2.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index a50f4ea9aa9c..92bd4ebd1aae 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -152,7 +152,10 @@ static void lcl_getHourMinuteSecond( double fTimeInDays, sal_Int32& nHour, sal_I
// If < 0 then approxFloor() effectively returned the ceiling (note this
// also holds for negative fTimeInDays values) because of a near identical
// value, shortcut this to a full day as well.
- if (fTime <= 0.0)
+ // If >= 1.0 (actually == 1.0) then fTimeInDays is a negative small value
+ // not significant for a representable time and approxFloor() returned -1,
+ // shortcut to 0:0:0, otherwise it would become 24:0:0.
+ if (fTime <= 0.0 || fTime >= 1.0)
{
nHour = nMinute = nSecond = 0;
return;