Version 1.1.1.1 of ais/ai-00113.txt
!standard 09.06 (26) 98-03-23 AI95-00113/01
!class binding interpretation 98-03-23
!status ARG Approved (with changes) 11-0-0 95-11-01
!status work item 96-04-04
!status received 96-04-04
!priority Low
!difficulty Easy
!subject Exception raised by Month, Day, Seconds in Ada.Calendar?
!summary 98-03-23
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 96-04-04
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?
!response 98-03-23
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.
!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.
****************************************************************
Questions? Ask the ACAA Technical Agent