annotate gcc/ada/libgnarl/a-reatim.ads @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
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 . R E A L _ T I M E --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
9 -- Copyright (C) 1992-2019, Free Software Foundation, Inc. --
111
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. The copyright notice above, and the license provisions that follow --
kono
parents:
diff changeset
13 -- apply solely to the contents of the part following the private keyword. --
kono
parents:
diff changeset
14 -- --
kono
parents:
diff changeset
15 -- GNAT is free software; you can redistribute it and/or modify it under --
kono
parents:
diff changeset
16 -- terms of the GNU General Public License as published by the Free Soft- --
kono
parents:
diff changeset
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
kono
parents:
diff changeset
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
kono
parents:
diff changeset
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
kono
parents:
diff changeset
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
kono
parents:
diff changeset
21 -- --
kono
parents:
diff changeset
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
kono
parents:
diff changeset
23 -- additional permissions described in the GCC Runtime Library Exception, --
kono
parents:
diff changeset
24 -- version 3.1, as published by the Free Software Foundation. --
kono
parents:
diff changeset
25 -- --
kono
parents:
diff changeset
26 -- You should have received a copy of the GNU General Public License and --
kono
parents:
diff changeset
27 -- a copy of the GCC Runtime Library Exception along with this program; --
kono
parents:
diff changeset
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
kono
parents:
diff changeset
29 -- <http://www.gnu.org/licenses/>. --
kono
parents:
diff changeset
30 -- --
kono
parents:
diff changeset
31 -- GNAT was originally developed by the GNAT team at New York University. --
kono
parents:
diff changeset
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
kono
parents:
diff changeset
33 -- --
kono
parents:
diff changeset
34 ------------------------------------------------------------------------------
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 with System.Task_Primitives.Operations;
kono
parents:
diff changeset
37 pragma Elaborate_All (System.Task_Primitives.Operations);
kono
parents:
diff changeset
38
kono
parents:
diff changeset
39 package Ada.Real_Time with
kono
parents:
diff changeset
40 SPARK_Mode,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
41 Abstract_State => (Clock_Time with Synchronous),
111
kono
parents:
diff changeset
42 Initializes => Clock_Time
kono
parents:
diff changeset
43 is
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 pragma Compile_Time_Error
kono
parents:
diff changeset
46 (Duration'Size /= 64,
kono
parents:
diff changeset
47 "this version of Ada.Real_Time requires 64-bit Duration");
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 type Time is private;
kono
parents:
diff changeset
50 Time_First : constant Time;
kono
parents:
diff changeset
51 Time_Last : constant Time;
kono
parents:
diff changeset
52 Time_Unit : constant := 10#1.0#E-9;
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 type Time_Span is private;
kono
parents:
diff changeset
55 Time_Span_First : constant Time_Span;
kono
parents:
diff changeset
56 Time_Span_Last : constant Time_Span;
kono
parents:
diff changeset
57 Time_Span_Zero : constant Time_Span;
kono
parents:
diff changeset
58 Time_Span_Unit : constant Time_Span;
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 Tick : constant Time_Span;
kono
parents:
diff changeset
61 function Clock return Time with
kono
parents:
diff changeset
62 Volatile_Function,
kono
parents:
diff changeset
63 Global => Clock_Time;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 function "+" (Left : Time; Right : Time_Span) return Time with
kono
parents:
diff changeset
66 Global => null;
kono
parents:
diff changeset
67 function "+" (Left : Time_Span; Right : Time) return Time with
kono
parents:
diff changeset
68 Global => null;
kono
parents:
diff changeset
69 function "-" (Left : Time; Right : Time_Span) return Time with
kono
parents:
diff changeset
70 Global => null;
kono
parents:
diff changeset
71 function "-" (Left : Time; Right : Time) return Time_Span with
kono
parents:
diff changeset
72 Global => null;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 function "<" (Left, Right : Time) return Boolean with
kono
parents:
diff changeset
75 Global => null;
kono
parents:
diff changeset
76 function "<=" (Left, Right : Time) return Boolean with
kono
parents:
diff changeset
77 Global => null;
kono
parents:
diff changeset
78 function ">" (Left, Right : Time) return Boolean with
kono
parents:
diff changeset
79 Global => null;
kono
parents:
diff changeset
80 function ">=" (Left, Right : Time) return Boolean with
kono
parents:
diff changeset
81 Global => null;
kono
parents:
diff changeset
82
kono
parents:
diff changeset
83 function "+" (Left, Right : Time_Span) return Time_Span with
kono
parents:
diff changeset
84 Global => null;
kono
parents:
diff changeset
85 function "-" (Left, Right : Time_Span) return Time_Span with
kono
parents:
diff changeset
86 Global => null;
kono
parents:
diff changeset
87 function "-" (Right : Time_Span) return Time_Span with
kono
parents:
diff changeset
88 Global => null;
kono
parents:
diff changeset
89 function "*" (Left : Time_Span; Right : Integer) return Time_Span with
kono
parents:
diff changeset
90 Global => null;
kono
parents:
diff changeset
91 function "*" (Left : Integer; Right : Time_Span) return Time_Span with
kono
parents:
diff changeset
92 Global => null;
kono
parents:
diff changeset
93 function "/" (Left, Right : Time_Span) return Integer with
kono
parents:
diff changeset
94 Global => null;
kono
parents:
diff changeset
95 function "/" (Left : Time_Span; Right : Integer) return Time_Span with
kono
parents:
diff changeset
96 Global => null;
kono
parents:
diff changeset
97
kono
parents:
diff changeset
98 function "abs" (Right : Time_Span) return Time_Span with
kono
parents:
diff changeset
99 Global => null;
kono
parents:
diff changeset
100
kono
parents:
diff changeset
101 function "<" (Left, Right : Time_Span) return Boolean with
kono
parents:
diff changeset
102 Global => null;
kono
parents:
diff changeset
103 function "<=" (Left, Right : Time_Span) return Boolean with
kono
parents:
diff changeset
104 Global => null;
kono
parents:
diff changeset
105 function ">" (Left, Right : Time_Span) return Boolean with
kono
parents:
diff changeset
106 Global => null;
kono
parents:
diff changeset
107 function ">=" (Left, Right : Time_Span) return Boolean with
kono
parents:
diff changeset
108 Global => null;
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 function To_Duration (TS : Time_Span) return Duration with
kono
parents:
diff changeset
111 Global => null;
kono
parents:
diff changeset
112 function To_Time_Span (D : Duration) return Time_Span with
kono
parents:
diff changeset
113 Global => null;
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 function Nanoseconds (NS : Integer) return Time_Span with
kono
parents:
diff changeset
116 Global => null;
kono
parents:
diff changeset
117 function Microseconds (US : Integer) return Time_Span with
kono
parents:
diff changeset
118 Global => null;
kono
parents:
diff changeset
119 function Milliseconds (MS : Integer) return Time_Span with
kono
parents:
diff changeset
120 Global => null;
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 function Seconds (S : Integer) return Time_Span with
kono
parents:
diff changeset
123 Global => null;
kono
parents:
diff changeset
124 pragma Ada_05 (Seconds);
kono
parents:
diff changeset
125
kono
parents:
diff changeset
126 function Minutes (M : Integer) return Time_Span with
kono
parents:
diff changeset
127 Global => null;
kono
parents:
diff changeset
128 pragma Ada_05 (Minutes);
kono
parents:
diff changeset
129
kono
parents:
diff changeset
130 type Seconds_Count is new Long_Long_Integer;
kono
parents:
diff changeset
131 -- Seconds_Count needs 64 bits, since the type Time has the full range of
kono
parents:
diff changeset
132 -- Duration. The delta of Duration is 10 ** (-9), so the maximum number of
kono
parents:
diff changeset
133 -- seconds is 2**63/10**9 = 8*10**9 which does not quite fit in 32 bits.
kono
parents:
diff changeset
134 -- However, rather than make this explicitly 64-bits we derive from
kono
parents:
diff changeset
135 -- Long_Long_Integer. In normal usage this will have the same effect. But
kono
parents:
diff changeset
136 -- in the case of CodePeer with a target configuration file with a maximum
kono
parents:
diff changeset
137 -- integer size of 32, it allows analysis of this unit.
kono
parents:
diff changeset
138
kono
parents:
diff changeset
139 procedure Split (T : Time; SC : out Seconds_Count; TS : out Time_Span)
kono
parents:
diff changeset
140 with
kono
parents:
diff changeset
141 Global => null;
kono
parents:
diff changeset
142 function Time_Of (SC : Seconds_Count; TS : Time_Span) return Time
kono
parents:
diff changeset
143 with
kono
parents:
diff changeset
144 Global => null;
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 private
kono
parents:
diff changeset
147 pragma SPARK_Mode (Off);
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 -- Time and Time_Span are represented in 64-bit Duration value in
kono
parents:
diff changeset
150 -- nanoseconds. For example, 1 second and 1 nanosecond is represented
kono
parents:
diff changeset
151 -- as the stored integer 1_000_000_001. This is for the 64-bit Duration
kono
parents:
diff changeset
152 -- case, not clear if this also is used for 32-bit Duration values.
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 type Time is new Duration;
kono
parents:
diff changeset
155
kono
parents:
diff changeset
156 Time_First : constant Time := Time'First;
kono
parents:
diff changeset
157
kono
parents:
diff changeset
158 Time_Last : constant Time := Time'Last;
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 type Time_Span is new Duration;
kono
parents:
diff changeset
161
kono
parents:
diff changeset
162 Time_Span_First : constant Time_Span := Time_Span'First;
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 Time_Span_Last : constant Time_Span := Time_Span'Last;
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 Time_Span_Zero : constant Time_Span := 0.0;
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 Time_Span_Unit : constant Time_Span := 10#1.0#E-9;
kono
parents:
diff changeset
169
kono
parents:
diff changeset
170 Tick : constant Time_Span :=
kono
parents:
diff changeset
171 Time_Span (System.Task_Primitives.Operations.RT_Resolution);
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 pragma Import (Intrinsic, "<");
kono
parents:
diff changeset
174 pragma Import (Intrinsic, "<=");
kono
parents:
diff changeset
175 pragma Import (Intrinsic, ">");
kono
parents:
diff changeset
176 pragma Import (Intrinsic, ">=");
kono
parents:
diff changeset
177 pragma Import (Intrinsic, "abs");
kono
parents:
diff changeset
178
kono
parents:
diff changeset
179 pragma Inline (Microseconds);
kono
parents:
diff changeset
180 pragma Inline (Milliseconds);
kono
parents:
diff changeset
181 pragma Inline (Nanoseconds);
kono
parents:
diff changeset
182 pragma Inline (Seconds);
kono
parents:
diff changeset
183 pragma Inline (Minutes);
kono
parents:
diff changeset
184
kono
parents:
diff changeset
185 end Ada.Real_Time;