Bug 127498 - TIMEVALUE() sometimes returns a slightly less or greater than expected value
Summary: TIMEVALUE() sometimes returns a slightly less or greater than expected value
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:24.2.0 target:7.6.4
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2019-09-11 13:24 UTC by retecomputer
Modified: 2023-11-22 15:28 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file for bug 127498 (18.61 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-09-11 13:26 UTC, retecomputer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description retecomputer 2019-09-11 13:24:51 UTC
Description:
Opening attached Test.ods file with version 6.1.5.2 (Debian Stable) TIMEVALUE formula works as expected, but opening with version 6.3.0.4 (Debian Testing) TIMEVALUE formula resolves with one second less than expected cells B3, B6, B9, B12, B15 (yellow highlighted). Inspecting content.xml it seems a rounding error.
Maybe it is related to bug 127334 ...
Regards!

Guido

Steps to Reproduce:
1. Open Test.ods file with version 6.3.0.4
2. Verify cells B3, B6, B9, B12, B15


Actual Results:
Sometime (but regularly) one second less than the time value of the text cells 

Expected Results:
Ever the time value of the text cells 


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Versione: 6.3.0.4
Build ID: 1:6.3.0-2
Thread CPU: 4; SO: Linux 5.2; Resa interfaccia: predefinito; VCL: kde5; 
Versione locale: it-IT (it_IT.UTF-8); Lingua interfaccia: it-IT
Calc: threaded
Comment 1 retecomputer 2019-09-11 13:26:38 UTC
Created attachment 154104 [details]
Test file for bug 127498
Comment 2 Oliver Brinzing 2019-09-11 17:08:02 UTC
reproducible with:

Version: 6.2.7.1 (x64)
Build-ID: 23edc44b61b830b7d749943e020e96f5a7df63bf
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: 

Version: 6.3.1.2 (x64)
Build-ID: b79626edf0065ac373bd1df5c28bd630b4424273
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; 
Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE
Calc: 

this issue *seems* to be a duplicate of:

Bug 125099 - Rounding of durations displayed as wall clock time.
Bug 127143 - Time addition short of one second in calc

@erack: shouldn't we add a [META] issue ?
Comment 3 Xisco Faulí 2019-09-17 14:18:13 UTC
Regression introduced by:

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

author	Eike Rathke <erack@redhat.com>	2018-08-31 11:21:03 +0200
committer	Eike Rathke <erack@redhat.com>	2018-08-31 12:50:52 +0200
commit e2e47898180e547cad7ccde1e5890385d573e551 (patch)
tree c91b4e1e053c69bbf0906953fe1bba276977ef2c
parent 370d4c9ba34913076f7a73a2912eb2e0e48ca73c (diff)
Use tools::Time::GetClock() in number formatter for wall clock time

Bisected with: bibisect-linux64-6.2 

Adding Cc: to Eike Rathke
Comment 4 Eike Rathke 2023-11-13 15:54:04 UTC
When using a time format with fractional seconds HH:MM:SS.000000000 it can easily be seen that due to floating point inaccuracies the values are

08:00:00.000000210
08:15:00.000000000
08:29:59.999999790
08:45:00.000000210
09:00:00.000000000
09:14:59.999999790
...

Let's do an internal rounding to 300 nanoseconds for TIMEVALUE() like it's now done in other date+time places as well.
Comment 5 Eike Rathke 2023-11-13 16:00:26 UTC
Note that the values were always the same also before the "regression", but previously only the display of wall clock time was rounded, which was changed with the commit mentioned.
Comment 6 Commit Notification 2023-11-13 18:32:35 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/61d5f971496cb0091f9b37aaafcb87694f3810ea

Resolves: tdf#127498 Force corrected TIMEVALUE() result

It will be available in 24.2.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.
Comment 7 Eike Rathke 2023-11-13 18:33:31 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/159246 for 7-6
Comment 8 Commit Notification 2023-11-14 10:14:08 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-7-6":

https://git.libreoffice.org/core/commit/7bc797fc5715dfd291554d84ba5fd821e9f30426

Resolves: tdf#127498 Force corrected TIMEVALUE() result

It will be available in 7.6.4.

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.
Comment 9 Commit Notification 2023-11-22 15:28:32 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9b2d6b36815cbfee8b44b87b7c0b3cb4bab61850

tdf#127498: sc_datetime_functions: Add unittest

It will be available in 24.2.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.