Bug 104253 - time math seems broken
Summary: time math seems broken
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-29 12:32 UTC by Ulrich Windl
Modified: 2022-03-16 14:00 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample Document (11.17 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-11-29 12:32 UTC, Ulrich Windl
Details
File written by Microsoft Excel (10.19 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-11-29 12:42 UTC, Ulrich Windl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Windl 2016-11-29 12:32:00 UTC
Created attachment 129115 [details]
Sample Document

I have a document that subtracts to timestamps (B2-A2), yielding C2 (which looks correct). Then I multiply C2 (yellow) by D2, giving E2 (orange) which does not look correct (value too small).
However when I enter the value output as C2 into B22 (yellow), the value D2 into C22, and multiply both, yielding D22, the result (green) looks correct.
This looks very much like a bug to me, and if so, it looks like a new bug.
Comment 1 Ulrich Windl 2016-11-29 12:42:47 UTC
Created attachment 129116 [details]
File written by Microsoft Excel

When I read the file from attachment 129115 [details] with Microsoft Excel, it complained, displaying some fields with "N/V". After reentering the formulas display looked OK, and when I entered B2 as "29.10.16 24:00", it was displayed as "29.10.16 00:00", and the result was OK! So I saved it as ODS.
Now when loading that file, the results are correct in Calc, also!
Comment 2 Ulrich Windl 2016-11-29 12:46:31 UTC
(In reply to Ulrich Windl from comment #1)
> (...), and when I entered B2 as "29.10.16 24:00", (...) the result was OK!
Also when I enter 29.10.16 00:00" in B2, the result is still correct, of course.
Comment 3 Eike Rathke 2016-11-29 13:52:53 UTC
A2 is greater than B2 (2016-10-28 14:05:00 and 2016-10-28 00:00:00) so =B2-A2 gives a negative value which you formatted as wall clock time instead of duration. Using format code [HH]:MM:SS instead on C2 will show -14:05:00 and for E2 (=C2*D2) -16:11:45
Comment 4 Ulrich Windl 2016-11-29 14:42:22 UTC
(In reply to Eike Rathke from comment #3)
> A2 is greater than B2 (2016-10-28 14:05:00 and 2016-10-28 00:00:00) so
> =B2-A2 gives a negative value which you formatted as wall clock time instead
> of duration. Using format code [HH]:MM:SS instead on C2 will show -14:05:00
> and for E2 (=C2*D2) -16:11:45

I don't understand: The difference from "28.10.16 14:05" to "28.10.16 00:00" is correctly displayed as "09:55:00"; what is not correct is the product of 1.2 times the duration ("09:55:00"). That works in D22. So effectively I see two different results for the same formula. Something must be wrong! Why isn't the default time format "[HH]:MM:SS" then?
Comment 5 Aron Budea 2016-11-29 15:17:29 UTC
(In reply to Ulrich Windl from comment #4)
> I don't understand: The difference from "28.10.16 14:05" to "28.10.16 00:00"
> is correctly displayed as "09:55:00"; what is not correct is the product of

The difference is -14:05:00, not 09:55:00.
Comment 6 Commit Notification 2022-03-16 07:43:03 UTC Comment hidden (obsolete)
Comment 7 Kevin Suo 2022-03-16 14:00:45 UTC
I think the commit message in comment 6 is a mistake.