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

--- Comment #33 from Albrecht Müller <[email protected]> ---
(In reply to Regina Henschel from comment #30)
> Created attachment 188724 [details]

> @Albrecht Müller:  The definition for LibreOffice is in
> https://help.libreoffice.org/latest/en-US/text/shared/01/05020301.html.
> However, the formatting of the functions result is not relevant here. 

Thank you for the link - I already knew the German version of it. I was not
able to find there any information about the distinction between wall clock
time and durations. If I understand Eike Rathke's concept correctly a
[HH]:MM:SS format should use a kind of rounding that is different from the
rounding used for HH:MM:SS formats. I did not find any information about this.

I think formatting could play a key role in the specification. A user may
probably expect that formatting and the second, minute functions etc. are
consistent. This expectation could be something like:

If the format "YYYY-MM-DD HH:MM:SS" formats some time value T to a string of
the form "<Year>-<Month>-<Day> <Hour>:<Minute>:<Second>"
then the integer value represented by the parts <Year>, <Month> etc.
should always be the values returned by the corresponding functions for the
argument T. This way the specification of these function follows as a corollary
from the specification of the formatting. Its just a special case.

You can put another example in your zoo: LibreOffice itself offers an
additional and on my machine incompatible implementation of the Second, Minute
etc. functions. The subroutine below is intended to produce the results for the
values you use the attachment.

Sub [Second, Minute etc.]()
   On Local Error Goto Errorhandler
   Dim V1 As Double
   Dim V2 As Double
   Dim V3 As Double
   Dim S1
   Dim S2
   Dim S3
   V1 = 45138
   V2 = 45138.999996
   V3 = 45138.999994
   S1 = Array("2023-07-31", "00:00:00,000")
   S2 = Array("2023-07-31", "23:59:59,654")
   S3 = Array("2023-07-31", "23:59:59,482")
   Dim D1 As Double
   Dim D2 As Double
   Dim D3 As Double
   D1 = DateValue(S1(Lbound(S1))) + TimeValue(S1(Ubound(S1))) 
   D2 = DateValue(S2(Lbound(S2))) + TimeValue(S2(Ubound(S2))) 
   D3 = DateValue(S3(Lbound(S3))) + TimeValue(S3(Ubound(S3))) 
   MsgBox(_
      V1 & "; " & Format(V1, "YYYY-MM-DD HH:MM:SS.000") & _
         "; Y: " & year(v1) & "; M: " & month(v1) & "; D: " & day(v1) _
         & "; H: " & hour(v1) & "; M: " & minute(v1) & "; S: " _
         & second(v1) & Chr$(13) _
      & V2 & "; " & Format(V2, "YYYY-MM-DD HH:MM:SS.000") & _
         "; Y: " & year(V2) & "; M: " & month(V2) & "; D: " & day(V2) _
         & "; H: " & hour(V2) & "; M: " & minute(V2) & "; S: " _
         & second(V2) & Chr$(13) _
      & V3 & "; " & Format(V3, "YYYY-MM-DD HH:MM:SS.000") & _
         "; Y: " & year(V3) & "; M: " & month(V3) & "; D: " & day(V3) _
         & "; H: " & hour(V3) & "; M: " & minute(V3) & "; S: " _
         & second(V3) & Chr$(13) _
      & D1 & "; " & S1 (Lbound(S1)) & " " & S1 (Ubound(S1)) & _
         "; Y: " & year(D1) & "; M: " & month(D1) & "; D: " & day(D1) _
         & "; H: " & hour(D1) & "; M: " & minute(D1) & "; S: " _
         & second(D1) & Chr$(13) _
      & D2 & "; " & S2 (Lbound(S2)) & " " & S2 (Ubound(S2)) & _
         "; Y: " & year(D2) & "; M: " & month(D2) & "; D: " & day(D2) _
         & "; H: " & hour(D2) & "; M: " & minute(D2) & "; S: " _
         & second(D2) & Chr$(13) _
      & D3 & "; " & S3 (Lbound(S3)) & " " & S3 (Ubound(S3)) & _
         "; Y: " & year(D3) & "; M: " & month(D3) & "; D: " & day(D3) _
         & "; H: " & hour(D3) & "; M: " & minute(D3) & "; S: " _
         & second(D3) & Chr$(13) _
   )   
   Exit Sub
Errorhandler:
   MsgBox "Fehler " & Err & ": " & Error$ & chr$(13) _
   & "in Subroutine [Second, Minute etc.](). Zeile: " & Erl _
   & chr$(13) & now
End Sub

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to