annotate gcc/ada/libgnat/a-calari.ads @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 ------------------------------------------------------------------------------
kono
parents:
diff changeset
2 -- --
kono
parents:
diff changeset
3 -- GNAT RUN-TIME COMPONENTS --
kono
parents:
diff changeset
4 -- --
kono
parents:
diff changeset
5 -- A D A . C A L E N D A R . A R I T H M E T I C --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
kono
parents:
diff changeset
9 -- Copyright (C) 2005-2017, Free Software Foundation, Inc. --
kono
parents:
diff changeset
10 -- --
kono
parents:
diff changeset
11 -- This specification is derived from the Ada Reference Manual for use with --
kono
parents:
diff changeset
12 -- GNAT. In accordance with the copyright of that document, you can freely --
kono
parents:
diff changeset
13 -- copy and modify this specification, provided that if you redistribute a --
kono
parents:
diff changeset
14 -- modified version, any changes that you have made are clearly indicated. --
kono
parents:
diff changeset
15 -- --
kono
parents:
diff changeset
16 ------------------------------------------------------------------------------
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 -- This package provides arithmetic operations of time values using days
kono
parents:
diff changeset
19 -- and leap seconds. Ada.Calendar.Arithmetic is defined in the Ada 2005
kono
parents:
diff changeset
20 -- RM (9.6.1).
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 package Ada.Calendar.Arithmetic is
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24 -- Arithmetic on days:
kono
parents:
diff changeset
25
kono
parents:
diff changeset
26 -- Rough estimate on the number of days over the range of Ada time
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 type Day_Count is range
kono
parents:
diff changeset
29 -(366 * (1 + Year_Number'Last - Year_Number'First))
kono
parents:
diff changeset
30 ..
kono
parents:
diff changeset
31 +(366 * (1 + Year_Number'Last - Year_Number'First));
kono
parents:
diff changeset
32
kono
parents:
diff changeset
33 subtype Leap_Seconds_Count is Integer range -2047 .. 2047;
kono
parents:
diff changeset
34 -- Count of leap seconds. Negative leap seconds occur whenever the
kono
parents:
diff changeset
35 -- astronomical time is faster than the atomic time or as a result of
kono
parents:
diff changeset
36 -- Difference when Left < Right.
kono
parents:
diff changeset
37
kono
parents:
diff changeset
38 procedure Difference
kono
parents:
diff changeset
39 (Left : Time;
kono
parents:
diff changeset
40 Right : Time;
kono
parents:
diff changeset
41 Days : out Day_Count;
kono
parents:
diff changeset
42 Seconds : out Duration;
kono
parents:
diff changeset
43 Leap_Seconds : out Leap_Seconds_Count);
kono
parents:
diff changeset
44 -- Returns the difference between Left and Right. Days is the number of
kono
parents:
diff changeset
45 -- days of difference, Seconds is the remainder seconds of difference
kono
parents:
diff changeset
46 -- excluding leap seconds, and Leap_Seconds is the number of leap seconds.
kono
parents:
diff changeset
47 -- If Left < Right, then Seconds <= 0.0, Days <= 0, and Leap_Seconds <= 0,
kono
parents:
diff changeset
48 -- otherwise all values are nonnegative. The absolute value of Seconds is
kono
parents:
diff changeset
49 -- always less than 86_400.0. For the returned values, if Days = 0, then
kono
parents:
diff changeset
50 -- Seconds + Duration (Leap_Seconds) = Calendar."-" (Left, Right)
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 function "+" (Left : Time; Right : Day_Count) return Time;
kono
parents:
diff changeset
53 function "+" (Left : Day_Count; Right : Time) return Time;
kono
parents:
diff changeset
54 -- Adds a number of days to a time value. Time_Error is raised if the
kono
parents:
diff changeset
55 -- result is not representable as a value of type Time.
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 function "-" (Left : Time; Right : Day_Count) return Time;
kono
parents:
diff changeset
58 -- Subtracts a number of days from a time value. Time_Error is raised if
kono
parents:
diff changeset
59 -- the result is not representable as a value of type Time.
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 function "-" (Left : Time; Right : Time) return Day_Count;
kono
parents:
diff changeset
62 -- Subtracts two time values, and returns the number of days between them.
kono
parents:
diff changeset
63 -- This is the same value that Difference would return in Days.
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 end Ada.Calendar.Arithmetic;