!standard 09.06 (26) 99-09-13 AI95-00113/04 !class binding interpretation 98-03-23 !status Corrigendum 2000 99-07-20 !status WG9 approved 98-06-12 !status ARG Approved (with changes) 11-0-0 97-11-16 !status work item 96-04-04 !status received 96-04-04 !priority Low !difficulty Easy !qualifier Omission !subject Exception raised by Month, Day, Seconds in Ada.Calendar? !summary The functions Month, Day, and Seconds in Ada.Calendar raise Time_Error if the year is outside the range of the subtype Year_Number. !question In the Ada.Calendar package, the function Year and the procedure Split raise Time_Error if the given Date parameter represents a date outside the range 1901 .. 2099. What do the functions Month, Day, and Seconds do with such a date? (Raise Time_Error.) !recommendation (See summary.) !wording !discussion The implementation model for these functions is that the procedure Split is first called and then the required result is extracted. For example function Month (Date : Time) return Month_Number is Y : Year_Number; M : Month_Number; D : Day_Number; S : Day_Duration; begin Split(Date, Y, M, D, S); return M; end Month; If Split raises Time_Error then, by propagation, Month will also raise Time_Error. !corrigendum 9.06(26) @drepl The exception Time_Error is raised by the function Time_Of if the actual parameters do not form a proper date. This exception is also raised by the operators "+" and "-" if the result is not representable in the type Time or Duration, as appropriate. This exception is also raised by the function Year or the procedure Split if the year number of the given date is outside of the range of the subtype Year_Number. @dby The exception Time_Error is raised by the function Time_Of if the actual parameters do not form a proper date. This exception is also raised by the operators "+" and "-" if the result is not representable in the type Time or Duration, as appropriate. This exception is also raised by the functions Year, Month, Day, and Seconds and the procedure Split if the year number of the given date is outside of the range of the subtype Year_Number. !ACATS test It would be possible to create a test to test the situation covered in this issue. This could be tested by creating a Time value with the year 2099, then calling "+" to move to year 2100. (That may raise Time_Error). If the "+" does not raise Time_Error, then call Month, Day, etc. and verify that Time_Error is raised. Such a test has little value; if an implementation returned the correct month, etc. rather than raising Time_Error, it would be harmless (although not portable). For many implementations, "+" would raise Time_Error (as that was required by Ada 83), and the test would be Not_Applicable. !appendix !section 9.6(26) !subject Exception raised by Month, Day, Seconds in Ada.Calendar? !reference RM95-9.6(26) !from Keith Thompson 95-11-10 !reference 95-5383.a Keith Thompson 95-11-10>> !discussion In the Ada.Calendar package, the function Year and the procedure Split raise Time_Error if the given Date parameter represents a date outside the range 1901 .. 2099. What do the functions Month, Day, and Seconds do with such a date? The current wording could be interpreted to allow (or require?) that, for a Date value representing noon, January 1, 2101, Split and Year raise Time_Error, but Month, Day, and Seconds return the values 1, 1, and 43_200.0, respectively. I suggest that the Month, Day, and Seconds functions should raise Time_Error whenever Split and Year raise Time_Error. **************************************************************** !section 9.6(40) !subject Year[_Number] !reference AARM95-9.6(40.a) !from Keith Thompson 95-11-10 !reference 95-5383.b Keith Thompson 95-11-10>> !discussion Year_Number is a subtype; Year is a function. Note also that if Month, Day, and Seconds are defined to raise Time_Error under the same conditions, this paragraph should be updated to reflect it. ****************************************************************