Bug 133389 - Date & time functions in StarBasic and Calc return different results
Summary: Date & time functions in StarBasic and Calc return different results
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4.3.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2020-05-25 19:27 UTC by Albrecht Müller
Modified: 2022-11-19 03:35 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file demonstrating different results of date & time functions (26.30 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-05-25 19:34 UTC, Albrecht Müller
Details
Example file demonstrating different results of date & time functions update (82.33 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-06-01 17:39 UTC, Albrecht Müller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albrecht Müller 2020-05-25 19:27:13 UTC
Description:
Bug 132083 shows an unexpected result of a simple date & time calculation. If you feed the very same values into the date & time functions of Calc and StarBasic you will get different results.



Steps to Reproduce:
Open the attachted example file in a context that allows the execution of macros.

Actual Results:
The Calc version of the MINUTE function returns a 9 minutes difference, the StarBasic version 10 minutes.

Expected Results:
Both versions of the MINUTE function should return 10 minutes as this is the difference between 18 and 8.


Reproducible: Always


User Profile Reset: No



Additional Info:
Calc Version: 6.4.3.2, Build-ID: 1:6.4.3-0ubuntu0.20.04.1, CPU-Threads: 4; BS: Linux 5.4; UI-Render: Standard; VCL: gtk3; Gebietsschema: de-DE (de_DE.UTF-8); UI-Sprache: de-DE, Calc: threaded
Comment 1 Albrecht Müller 2020-05-25 19:34:36 UTC
Created attachment 161278 [details]
Example file demonstrating different results of date & time functions
Comment 2 Eike Rathke 2020-05-25 21:31:08 UTC
The usual confusion of timestamp and duration. The example applies the non-rounding MINUTE() wall clock / timestamp spreadsheet function on a time difference or duration value with a slight imprecision.

  =A5*24     => 0.166666666388889
  =A5*24*60  => 9.99999998333333

I don't know if there is a standard definition (VBA?) for the BASIC Minute() function, but the spreadsheet MINUTE() function is defined to not round, see https://docs.oasis-open.org/office/OpenDocument/v1.3/cs01/part4-formula/OpenDocument-v1.3-cs01-part4-formula.html#MINUTE

The difference between not-/rounding is also visible by applying the HH:MM:SS wall clock number format (00:09:59) instead of the correct [HH]:MM:SS duration format (00:10:00) on A5.
Comment 3 Albrecht Müller 2020-06-01 17:39:03 UTC
Created attachment 161500 [details]
Example file demonstrating different results of date & time functions  update

(In reply to Eike Rathke from comment #2)
> The usual confusion of timestamp and duration.

Did I get timestamp and duration right this time?
Comment 4 QA Administrators 2022-11-19 03:35:40 UTC
Dear Albrecht Müller,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug