Bug 119533 - calculation of MINUTE() wrong in LibreOffice 6.1
Summary: calculation of MINUTE() wrong in LibreOffice 6.1
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: high major
Assignee: Eike Rathke
URL:
Whiteboard: target:6.2.0 target:6.1.2 target:6.1....
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2018-08-27 09:34 UTC by Jonathan Brielmaier
Modified: 2020-08-02 09:36 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Reproduces time difference calculating error in LibreOffice 6.1.0.3 (13.90 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-08-27 09:34 UTC, Jonathan Brielmaier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Brielmaier 2018-08-27 09:34:22 UTC
Created attachment 144477 [details]
Reproduces time difference calculating error in LibreOffice 6.1.0.3

In my time keep table, I found a bug in calculating of the break time.
I attached a document ( reproducing_break_calculating_error.ods) which reproduces this bug.

When I open the document in LibreOffice 6.0.6.2:
08:00	18:00	12:30	13:00	0,5	9,5

When opening the document in LibreOffice 6.1.0.3:
08:00	18:00	12:30	13:00	0,483333333333333	9,51666666666667

I used the RPMs from libreoffice.org. Initially I reproduced this on openSUSE Tumbleweed (libreoffice 6.1.0.3-1.3) and openSUSE Leap 15.0 (libreoffice 6.0.4.2-lp150.1.3).

Is this bug/behaviour already known?
Comment 1 Xisco Faulí 2018-08-27 09:49:22 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=c69e7266916ac1b8917477fb4eccdb9098da5792

author	Winfried Donkers <winfrieddonkers@libreoffice.org>	2018-07-19 12:05:14 +0200
committer	Eike Rathke <erack@redhat.com>	2018-07-19 14:01:30 +0200
commit c69e7266916ac1b8917477fb4eccdb9098da5792 (patch)
tree 2cbfb1c40fec024a35eb784fc90da9c664672a27
parent ad1fb1c3dfb04e956d8793a320714c1ae1ba5941 (diff)
tdf#118800 fix rounding error in Calc function HOUR, MINUTE, SECOND.

Bisected with: bibisect-linux64-6.2

Adding Cc: to Winfried Donkers
Comment 2 Eike Rathke 2018-08-27 10:13:56 UTC
So it seems we indeed need the extra rounding, but *sometimes* must not. Problem here is that MINUTE(D2-C2) (30 minutes) yields 29 instead of 30.

@Jonathan:
Apart from that your calculation can be simplified to (for cell E2)
=(D2-C2)*24
which yields the correct result, and in cell F2
=(B2-A2)*24-E2
Note that dates and time is measured in days and fractions of day (1 day == 24 hours, 0.5==12h, ...)
Comment 3 Eike Rathke 2018-08-27 10:15:37 UTC
Taking.
Comment 4 Jonathan Brielmaier 2018-08-27 10:52:35 UTC
Thanks Xisco and Eike for your fast response.

Do the commits mentioned in https://bugs.documentfoundation.org/show_bug.cgi?id=118800 already fix this issue? Because in the 6.1.0.3 build we use in openSUSE this fix is already in, but the bug is still there:
https://build.opensuse.org/package/show/LibreOffice:Factory/libreoffice

For the record the openSUSE downstream bug:
https://bugzilla.opensuse.org/show_bug.cgi?id=1106073
Comment 5 Eike Rathke 2018-08-27 10:57:25 UTC
(In reply to Jonathan Brielmaier from comment #4)
> Do the commits mentioned in
> https://bugs.documentfoundation.org/show_bug.cgi?id=118800 already fix this
> issue?
No, they cause the problem.
Comment 6 Commit Notification 2018-08-27 22:16:18 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=273b3e10eab70ebc084cb62568bd699fddfb376e

Resolves: tdf#119533 reintroduce time rounding but cut, tdf#118800 follow-up

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Eike Rathke 2018-08-27 22:20:16 UTC
Pending review
https://gerrit.libreoffice.org/59678 for 6-1
https://gerrit.libreoffice.org/59679 for 6-1-1
Comment 8 Xisco Faulí 2018-08-28 09:36:59 UTC
Verified in

Version: 6.2.0.0.alpha0+
Build ID: a922f56cbf25f78534cd2d36bf13a86a4f15d970
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: threaded

@Eike Rathke, Thanks for fixing this!!
Comment 9 Jonathan Brielmaier 2018-08-28 10:13:12 UTC
I picked up Eike's patch ontop of 6.1.0.3 and can verify that it solves the issue!

Version: 6.1.0.3
Build-ID: 10(Build:3)
CPU-Threads: 8; BS: Linux 4.12; UI-Render: Standard; VCL: gtk3; 
Gebietsschema: de-DE (de_DE.UTF-8); Calc: group threaded

@Eike and @Xisco: Thanks again for fixing this issue so fast :)
Comment 10 Commit Notification 2018-08-28 10:50:20 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=98cb91686901dc0133c5c23dc5658d9623dbd436

Shortcut small negative values to 0:0:0, tdf#119533 tdf#118800 follow-up

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Eike Rathke 2018-08-28 19:39:33 UTC
(In reply to Jonathan Brielmaier from comment #9)
> @Eike and @Xisco: Thanks again for fixing this issue so fast :)
Thanks for reporting and verifying so fast :-)
Comment 12 Commit Notification 2018-09-04 08:01:30 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=184aee6abd202f6f4e2c18d21f96a0d1a9fd947f&h=libreoffice-6-1

Resolves: tdf#119533 reintroduce time rounding but cut, tdf#118800 follow-up

It will be available in 6.1.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 13 Commit Notification 2018-09-06 15:51:58 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-6-1-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=34887e7a8d36603ade1a0621d511906b826d0298&h=libreoffice-6-1-1

Resolves: tdf#119533 reintroduce time rounding but cut, tdf#118800 follow-up

It will be available in 6.1.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Commit Notification 2020-08-02 09:36:30 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/47ca84c47b03009fc9be751f1090f583bb3f53b7

tdf#119533: sc_subsequent_filters_test: Add unittest

It will be available in 7.1.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.