!standard 9.6.1(70/2) 11-03-11 AI05-0238-1/02 !class binding interpretation 11-01-30 !status Amendment 2012 11-03-11 !status ARG Approved 7-0-1 11-02-20 !status work item 11-01-30 !status received 10-07-01 !priority Low !difficulty Easy !qualifier Omission !subject Split behavior at the limit !summary Split raises Time_Error if Seconds is exactly 86400.0. !question What happens if Ada.Calendar.Formatting.Split is passed 86400.0? 9.6.1(70/2) includes the wording "The value returned in the Sub_Second parameter is always less than 1.0". That means that there is no legitimate result if the Seconds parameter is exactly 86400.0. The language should define this somehow. !recommendation (See Summary.) !wording Add to the end of 9.6.1(70/2): If Seconds = 86400.0, Split propagates Time_Error. AARM Reason: If Seconds = 86400.0, one of the returned values would have to be out of its defined range (either Sub_Second = 1.0 or Hour = 24 with the other value being 0). This doesn't seem worth breaking the invariants. !discussion We choose Time_Error as that is what the existing GNAT implementation does, that was the first and most-widely used implementation, and this doesn't seem important enough to change that implementation do to something else. Breaking the invariant to allow Sub_Second to be exactly 1.0 in that case doesn't seem any more useful; display routines that assume that Sub_Second is always less than 1.0 would have to figure out where to stick the extra second; no answer seems great there either. Note that the Split procedures that take a complete Time can deal with this problem by changing the returned values to represent midnight on the next day. !corrigendum 9.6.1(70/2) @drepl @xindent @dby @xindent !ACATS test Add an ACATS C-test to check this issue. !appendix !topic Split behavior undefined at the extreme !reference 9.6.1(69-70/2) !from Adam Beneschan 10-07-01 !discussion As long as we're discussing 9.6.1, I think this is an error: procedure Split (Seconds : in Day_Duration; Hour : out Hour_Number; Minute : out Minute_Number; Second : out Second_Number; Sub_Second : out Second_Duration); AI95-427 added the clause "The value returned in the Sub_Second parameter is always less than 1.0". However, this means that there is no possible result if Seconds = Day_Duration'Last (= 86400.0). The RM doesn't specify the behavior in that case; it probably should. GNAT raises Time_Error. The alternative is that this is the only case where Sub_Second could be 1.0. What's the correct semantics? P.S. I apologize if this is the sort of thing that I should have waited until October to submit. I thought it was possibly a serious enough error to maybe deal with now. ****************************************************************