[Libreoffice-bugs] [Bug 124303] New: Formatting [HH]:mm sometimes looses a second

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Sun Mar 24 06:40:11 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=124303

            Bug ID: 124303
           Summary: Formatting [HH]:mm sometimes looses a second
           Product: LibreOffice
           Version: 6.2.0.3 release
          Hardware: x86-64 (AMD64)
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: martin at atke-bentsen.dk

Description:
Using the [HH] formatting can result in some inapropriate floorings of the
underlying double value of a datetime, loosing a second, that can propagate up
to loosing a minute or an hour. Quite problematic when using LibreCalc to
calculate saleries of hourly paid employees. Using HH (without the brackets),
there is proper rounding to avoid this precision problem of floats to propagate
up to loosing a second. See steps to reproduce.

Steps to Reproduce:
1. In cell A1 write 17:   (will show 17:00:00)
2. In cell B1 write 21:   (will show 21:00:00)
3. In cell C1 write =B1-A1   (will show 04:00:00   correct)
4. Change format of C1 to: [HH]:mm  (will show 03:59   wrong)
5. Change format of C1 to: [HH]:MM:SS.000000000000000 (will show
03:59:59.999999999996362   wrong)
6. Change format of C1 to: HH:MM:SS.000000000000000 (will show
04:00:00.000000000000000   correct, but wont work as [HH] when above 24 hours)


Actual Results:
03:59

Expected Results:
04:00


Reproducible: Always


User Profile Reset: Yes



Additional Info:
I think this problem started around v4, and is still a problem i v6. Was not a
problem in some old v3.

A workaround i have been using is to add a second, that is then rounded of when
only showing minutes. Like in reproduce example, in C1 write: 
=B1-A1+"00:00:01"   
and format [HH]:mm

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190324/08d33114/attachment-0001.html>


More information about the Libreoffice-bugs mailing list