Package: Ada.Calendar.Arithmetic

Dependencies

pragma License (Unrestricted);

Description

AI-351

Header

package Ada.Calendar.Arithmetic is
 

Type Summary

Day_Count

Other Items:

type Day_Count is
   range -366 * (1 + Year_Number'Last - Year_Number'First) ..
          366 * (1 + Year_Number'Last - Year_Number'First);

subtype Leap_Seconds_Count is Integer range -999 .. 999;

procedure Difference (Left, Right  : in  Time;
                      Days         : out Day_Count;
                      Seconds      : out Duration;
                      Leap_Seconds : out Leap_Seconds_Count);
Returns the difference between Left and Right. Days is the number of days of difference, Seconds is the remainder seconds of difference, and Leap_Seconds is the number of leap seconds.

If Left < Right then Second <= 0.0, Days <= 0, and Leap_Seconds <= 0. Otherwise, all values are non-negative.

For the returned values, if Days = 0, then If Days = 0, then Seconds + Duration(Leap_Seconds) = Calendar."-" (Left, Right).

AARM Notes:

The number of days is calculated midnight-to-midnight. Leap_Seconds, if any, are not included in Seconds.

Leap_Seconds should be included in calculations using the operators defined in Calendar, as is specified for "-" above.


function "+" (Left : in Time; Right : in Day_Count) return Time;
Add a number of days to a time value. Time_Error is raised if the result is not representable as a value of type Time.

function "+" (Left : in Day_Count; Right : in Time) return Time;
Add a number of days to a time value. Time_Error is raised if the result is not representable as a value of type Time.

function "-" (Left : in Time; Right : in Day_Count) return Time;
Subtract a number of days from a time value. Time_Error is raised if the result is not representable as a value of type Time.

function "-" (Left, Right : in Time) return Day_Count;
Subtract two time values, and return the number of days between them. This is the same value that Difference would return in Days.
end Ada.Calendar.Arithmetic;