[Libreoffice-bugs] [Bug 127170] Clarify clock time (HH:MM, MM:SS, ...) and duration time ([HH]:MM, [MM]:SS, ...) formatting in help; (ignore the MM month vs minute discussion)

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed May 20 19:13:34 UTC 2020


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

--- Comment #18 from Albrecht Müller <albrecht.mueller at astrail.de> ---
The analysis in attachment 160356 suggests a workaround that allows LibreOffice
to display correct results for points in time. I don’t know if this workaround
works for durations as a different rounding mechanism may be used.

The workaround is based the assumption that the date and time functions
(including formatting) will deliver correct values for a subset of their
domain. The idea is to map any values to that subset where the functions behave
correctly.

Assume that t is some floating point number that is used to represent some
point in time. Then this value is mapped to (round(t*86400) + 0.1)/86400

This is expected to have the following effects:

a) The situation where the behaviour of the SECOND function is undefined cannot
occur. The round function which is called within SECOND function should get
values such as 0.1, 1.1, … 59.1 which it will round to 0, 1, … 59. A value such
as 59.7 which should be rounded to 60 cannot occur. Thus this problem should be
gone.

b) The round down mechanism used in the other date and time functions will
always get a value that is a fraction of a second above the correct value.
Therefore rounding down will round to this correct value. This should solve the
problem that the round down mechanism may produce results that are perceived as
arithmetic errors.

Remarks: The mapped value contains an intentional error and therefore should
not be used for further calculations! The workaround cannot easily extended to
respect fractional parts as the SECOND function is specified to round to the
nearest second.

-- 
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/20200520/3842e9ae/attachment-0001.htm>


More information about the Libreoffice-bugs mailing list