AI22-0049-1
!standard 9.6(13) 22-10-25 AI22-0049-1/01
!standard 9.6.1(23/2)
!standard 9.6.1(58/2)
!class Amendment 22-10-25
!status work item 22-10-25
!status received 22-07-19
!priority Low
!difficulty Easy
!subject Seconds function with Time_Zone parameter
Add a function Seconds_in_Day to Ada.Calendar.Formatting.
Ada.Calendar.Formatting should provide a function to get Day_Duration with a time_zone offset.
Currently, the simplest call is to use the Split function that returns ""Seconds"" as a Day_Duration, along with all the other parameters.
(See Summary.)
Add after 9.6.1(23/2):
function Seconds_in_Day (Date : Time;
Time_Zone : Time_Zones.Time_Offset) return Day_Duration;
Add after 9.6.1(58/2):
function Seconds_in_Day (Date : Time;
Time_Zone : Time_Zones.Time_Offset) return Day_Duration;
Returns the number of seconds in Date, as appropriate for the specified type zone offset.
The original version of this package omitted a Seconds function as it seemed to be easily confused with the more useful Second function (as well as the Seconds_Of function). We side-step this issue by calling the new function Seconds_of_Day (rather than just Seconds).
Another reason that the function was omitted is that the Day_Duration type is rather vestigial. It was defined by the original Ada.Calendar but really does not have much use in the new packages. In Ada 83/95 programs, it was often used as part of calculating time differences (as the original “-” function risks Constraint_Error if the time difference can exceed one day), but that functionality is better accomplished using the facilities of Ada.Calendar.Arithmetic. It also was used for display purposes, but it is hard to correctly extract the hours and minutes from that value, and the facilities in Ada.Calendar.Formatting are much more likely to handle the boundary conditions correctly. So in new and substantially modified code (that is, any which uses Time_Zones or other facilities from the 9.6.1), the use cases for which Day_Duration would be useful are very limited. (The author does not know of any.)
An ACATS C-Test should be made for a new function.
This AI was constructed from Github Issue #18 (https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues/18).
*************************************************