annotate gcc/ada/libgnat/a-calend.ads @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
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 --
kono
parents:
diff changeset
6 -- --
kono
parents:
diff changeset
7 -- S p e c --
kono
parents:
diff changeset
8 -- --
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
9 -- Copyright (C) 1992-2018, 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 package Ada.Calendar with
kono
parents:
diff changeset
37 SPARK_Mode,
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
38 Abstract_State => (Clock_Time with Synchronous),
111
kono
parents:
diff changeset
39 Initializes => Clock_Time
kono
parents:
diff changeset
40 is
kono
parents:
diff changeset
41
kono
parents:
diff changeset
42 type Time is private;
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 -- Declarations representing limits of allowed local time values. Note that
kono
parents:
diff changeset
45 -- these do NOT constrain the possible stored values of time which may well
kono
parents:
diff changeset
46 -- permit a larger range of times (this is explicitly allowed in Ada 95).
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 subtype Year_Number is Integer range 1901 .. 2399;
kono
parents:
diff changeset
49 subtype Month_Number is Integer range 1 .. 12;
kono
parents:
diff changeset
50 subtype Day_Number is Integer range 1 .. 31;
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 -- A Day_Duration value of 86_400.0 designates a new day
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 subtype Day_Duration is Duration range 0.0 .. 86_400.0;
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 function Clock return Time with
kono
parents:
diff changeset
57 Volatile_Function,
kono
parents:
diff changeset
58 Global => Clock_Time;
kono
parents:
diff changeset
59 -- The returned time value is the number of nanoseconds since the start
kono
parents:
diff changeset
60 -- of Ada time (1901-01-01 00:00:00.0 UTC). If leap seconds are enabled,
kono
parents:
diff changeset
61 -- the result will contain all elapsed leap seconds since the start of
kono
parents:
diff changeset
62 -- Ada time until now.
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 function Year (Date : Time) return Year_Number;
kono
parents:
diff changeset
65 function Month (Date : Time) return Month_Number;
kono
parents:
diff changeset
66 function Day (Date : Time) return Day_Number;
kono
parents:
diff changeset
67 function Seconds (Date : Time) return Day_Duration;
kono
parents:
diff changeset
68
kono
parents:
diff changeset
69 procedure Split
kono
parents:
diff changeset
70 (Date : Time;
kono
parents:
diff changeset
71 Year : out Year_Number;
kono
parents:
diff changeset
72 Month : out Month_Number;
kono
parents:
diff changeset
73 Day : out Day_Number;
kono
parents:
diff changeset
74 Seconds : out Day_Duration);
kono
parents:
diff changeset
75 -- Break down a time value into its date components set in the current
kono
parents:
diff changeset
76 -- time zone. If Split is called on a time value created using Ada 2005
kono
parents:
diff changeset
77 -- Time_Of in some arbitrary time zone, the input value will always be
kono
parents:
diff changeset
78 -- interpreted as relative to the local time zone.
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 function Time_Of
kono
parents:
diff changeset
81 (Year : Year_Number;
kono
parents:
diff changeset
82 Month : Month_Number;
kono
parents:
diff changeset
83 Day : Day_Number;
kono
parents:
diff changeset
84 Seconds : Day_Duration := 0.0) return Time;
kono
parents:
diff changeset
85 -- GNAT Note: Normally when procedure Split is called on a Time value
kono
parents:
diff changeset
86 -- result of a call to function Time_Of, the out parameters of procedure
kono
parents:
diff changeset
87 -- Split are identical to the in parameters of function Time_Of. However,
kono
parents:
diff changeset
88 -- when a non-existent time of day is specified, the values for Seconds
kono
parents:
diff changeset
89 -- may or may not be different. This may happen when Daylight Saving Time
kono
parents:
diff changeset
90 -- (DST) is in effect, on the day when switching to DST, if Seconds
kono
parents:
diff changeset
91 -- specifies a time of day in the hour that does not exist. For example,
kono
parents:
diff changeset
92 -- in New York:
kono
parents:
diff changeset
93 --
kono
parents:
diff changeset
94 -- Time_Of (Year => 1998, Month => 4, Day => 5, Seconds => 10740.0)
kono
parents:
diff changeset
95 --
kono
parents:
diff changeset
96 -- will return a Time value T. If Split is called on T, the resulting
kono
parents:
diff changeset
97 -- Seconds may be 14340.0 (3:59:00) instead of 10740.0 (2:59:00 being
kono
parents:
diff changeset
98 -- a time that not exist).
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 function "+" (Left : Time; Right : Duration) return Time;
kono
parents:
diff changeset
101 function "+" (Left : Duration; Right : Time) return Time;
kono
parents:
diff changeset
102 function "-" (Left : Time; Right : Duration) return Time;
kono
parents:
diff changeset
103 function "-" (Left : Time; Right : Time) return Duration;
kono
parents:
diff changeset
104 -- The first three functions will raise Time_Error if the resulting time
kono
parents:
diff changeset
105 -- value is less than the start of Ada time in UTC or greater than the
kono
parents:
diff changeset
106 -- end of Ada time in UTC. The last function will raise Time_Error if the
kono
parents:
diff changeset
107 -- resulting difference cannot fit into a duration value.
kono
parents:
diff changeset
108
kono
parents:
diff changeset
109 function "<" (Left, Right : Time) return Boolean;
kono
parents:
diff changeset
110 function "<=" (Left, Right : Time) return Boolean;
kono
parents:
diff changeset
111 function ">" (Left, Right : Time) return Boolean;
kono
parents:
diff changeset
112 function ">=" (Left, Right : Time) return Boolean;
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 Time_Error : exception;
kono
parents:
diff changeset
115
kono
parents:
diff changeset
116 private
kono
parents:
diff changeset
117 -- Mark the private part as SPARK_Mode Off to avoid accounting for variable
kono
parents:
diff changeset
118 -- Invalid_Time_Zone_Offset in abstract state.
kono
parents:
diff changeset
119
kono
parents:
diff changeset
120 pragma SPARK_Mode (Off);
kono
parents:
diff changeset
121
kono
parents:
diff changeset
122 pragma Inline (Clock);
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 pragma Inline (Year);
kono
parents:
diff changeset
125 pragma Inline (Month);
kono
parents:
diff changeset
126 pragma Inline (Day);
kono
parents:
diff changeset
127
kono
parents:
diff changeset
128 pragma Inline ("+");
kono
parents:
diff changeset
129 pragma Inline ("-");
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 pragma Inline ("<");
kono
parents:
diff changeset
132 pragma Inline ("<=");
kono
parents:
diff changeset
133 pragma Inline (">");
kono
parents:
diff changeset
134 pragma Inline (">=");
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 -- The units used in this version of Ada.Calendar are nanoseconds. The
kono
parents:
diff changeset
137 -- following constants provide values used in conversions of seconds or
kono
parents:
diff changeset
138 -- days to the underlying units.
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 Nano : constant := 1_000_000_000;
kono
parents:
diff changeset
141 Nano_F : constant := 1_000_000_000.0;
kono
parents:
diff changeset
142 Nanos_In_Day : constant := 86_400_000_000_000;
kono
parents:
diff changeset
143 Secs_In_Day : constant := 86_400;
kono
parents:
diff changeset
144
kono
parents:
diff changeset
145 ----------------------------
kono
parents:
diff changeset
146 -- Implementation of Time --
kono
parents:
diff changeset
147 ----------------------------
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 -- Time is represented as a signed 64 bit integer count of nanoseconds
kono
parents:
diff changeset
150 -- since the start of Ada time (1901-01-01 00:00:00.0 UTC). Time values
kono
parents:
diff changeset
151 -- produced by Time_Of are internally normalized to UTC regardless of their
kono
parents:
diff changeset
152 -- local time zone. This representation ensures correct handling of leap
kono
parents:
diff changeset
153 -- seconds as well as performing arithmetic. In Ada 95, Split and Time_Of
kono
parents:
diff changeset
154 -- will treat a time value as being in the local time zone, in Ada 2005,
kono
parents:
diff changeset
155 -- Split and Time_Of will treat a time value as being in the designated
kono
parents:
diff changeset
156 -- time zone by the formal parameter or in UTC by default. The size of the
kono
parents:
diff changeset
157 -- type is large enough to cover the Ada 2005 range of time (1901-01-01
kono
parents:
diff changeset
158 -- 00:00:00.0 UTC - 2399-12-31-23:59:59.999999999 UTC).
kono
parents:
diff changeset
159
kono
parents:
diff changeset
160 ------------------
kono
parents:
diff changeset
161 -- Leap Seconds --
kono
parents:
diff changeset
162 ------------------
kono
parents:
diff changeset
163
kono
parents:
diff changeset
164 -- Due to Earth's slowdown, the astronomical time is not as precise as the
kono
parents:
diff changeset
165 -- International Atomic Time. To compensate for this inaccuracy, a single
kono
parents:
diff changeset
166 -- leap second is added after the last day of June or December. The count
kono
parents:
diff changeset
167 -- of seconds during those occurrences becomes:
kono
parents:
diff changeset
168
kono
parents:
diff changeset
169 -- ... 58, 59, leap second 60, 0, 1, 2 ...
kono
parents:
diff changeset
170
kono
parents:
diff changeset
171 -- Unlike leap days, leap seconds occur simultaneously around the world.
kono
parents:
diff changeset
172 -- In other words, if a leap second occurs at 23:59:60 UTC, it also occurs
kono
parents:
diff changeset
173 -- on 18:59:60 -5 the same day or 2:59:60 +2 on the next day.
kono
parents:
diff changeset
174
kono
parents:
diff changeset
175 -- Leap seconds do not follow a formula. The International Earth Rotation
kono
parents:
diff changeset
176 -- and Reference System Service decides when to add one. Leap seconds are
kono
parents:
diff changeset
177 -- included in the representation of time in Ada 95 mode. As a result,
kono
parents:
diff changeset
178 -- the following two time values will differ by two seconds:
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 -- 1972-06-30 23:59:59.0
kono
parents:
diff changeset
181 -- 1972-07-01 00:00:00.0
kono
parents:
diff changeset
182
kono
parents:
diff changeset
183 -- When a new leap second is introduced, the following steps must be
kono
parents:
diff changeset
184 -- carried out:
kono
parents:
diff changeset
185
kono
parents:
diff changeset
186 -- 1) Increment Leap_Seconds_Count in a-calend.adb by one
kono
parents:
diff changeset
187 -- 2) Increment LS_Count in xleaps.adb by one
kono
parents:
diff changeset
188 -- 3) Add the new date to the aggregate of array LS_Dates in
kono
parents:
diff changeset
189 -- xleaps.adb
kono
parents:
diff changeset
190 -- 4) Compile and execute xleaps
kono
parents:
diff changeset
191 -- 5) Replace the values of Leap_Second_Times in a-calend.adb with the
kono
parents:
diff changeset
192 -- aggregate generated by xleaps
kono
parents:
diff changeset
193
kono
parents:
diff changeset
194 -- The algorithms that build the actual leap second values and discover
kono
parents:
diff changeset
195 -- how many leap seconds have occurred between two dates do not need any
kono
parents:
diff changeset
196 -- modification.
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 ------------------------------
kono
parents:
diff changeset
199 -- Non-leap Centennial Years --
kono
parents:
diff changeset
200 ------------------------------
kono
parents:
diff changeset
201
kono
parents:
diff changeset
202 -- Over the range of Ada time, centennial years 2100, 2200 and 2300 are
kono
parents:
diff changeset
203 -- non-leap. As a consequence, seven non-leap years occur over the period
kono
parents:
diff changeset
204 -- of year - 4 to year + 4. Internally, routines Split and Time_Of add or
kono
parents:
diff changeset
205 -- subtract a "fake" February 29 to facilitate the arithmetic involved.
kono
parents:
diff changeset
206
kono
parents:
diff changeset
207 ------------------------
kono
parents:
diff changeset
208 -- Local Declarations --
kono
parents:
diff changeset
209 ------------------------
kono
parents:
diff changeset
210
kono
parents:
diff changeset
211 type Time_Rep is new Long_Long_Integer;
kono
parents:
diff changeset
212 type Time is new Time_Rep;
kono
parents:
diff changeset
213 -- The underlying type of Time has been chosen to be a 64 bit signed
kono
parents:
diff changeset
214 -- integer number since it allows for easier processing of sub-seconds
kono
parents:
diff changeset
215 -- and arithmetic. We use Long_Long_Integer to allow this unit to compile
kono
parents:
diff changeset
216 -- when using custom target configuration files where the max integer is
kono
parents:
diff changeset
217 -- 32 bits. This is useful for static analysis tools such as SPARK or
kono
parents:
diff changeset
218 -- CodePeer.
kono
parents:
diff changeset
219 --
kono
parents:
diff changeset
220 -- Note: the reason we have two separate types here is to avoid problems
kono
parents:
diff changeset
221 -- with overloading ambiguities in the body if we tried to use Time as an
kono
parents:
diff changeset
222 -- internal computational type.
kono
parents:
diff changeset
223
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
224 function Epoch_Offset return Time_Rep;
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
225 pragma Inline (Epoch_Offset);
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
226 -- Return the difference between 2150-1-1 UTC and 1970-1-1 UTC expressed in
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
227 -- nanoseconds. Note that year 2100 is non-leap.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
228
111
kono
parents:
diff changeset
229 Days_In_Month : constant array (Month_Number) of Day_Number :=
kono
parents:
diff changeset
230 (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
kono
parents:
diff changeset
231 -- Days in month for non-leap year, leap year case is adjusted in code
kono
parents:
diff changeset
232
kono
parents:
diff changeset
233 Invalid_Time_Zone_Offset : Long_Integer;
kono
parents:
diff changeset
234 pragma Import (C, Invalid_Time_Zone_Offset, "__gnat_invalid_tzoff");
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236 function Is_Leap (Year : Year_Number) return Boolean;
kono
parents:
diff changeset
237 -- Determine whether a given year is leap
kono
parents:
diff changeset
238
kono
parents:
diff changeset
239 ----------------------------------------------------------
kono
parents:
diff changeset
240 -- Target-Independent Interface to Children of Calendar --
kono
parents:
diff changeset
241 ----------------------------------------------------------
kono
parents:
diff changeset
242
kono
parents:
diff changeset
243 -- The following packages provide a target-independent interface to the
kono
parents:
diff changeset
244 -- children of Calendar - Arithmetic, Conversions, Delays, Formatting and
kono
parents:
diff changeset
245 -- Time_Zones.
kono
parents:
diff changeset
246
kono
parents:
diff changeset
247 ---------------------------
kono
parents:
diff changeset
248 -- Arithmetic_Operations --
kono
parents:
diff changeset
249 ---------------------------
kono
parents:
diff changeset
250
kono
parents:
diff changeset
251 package Arithmetic_Operations is
kono
parents:
diff changeset
252
kono
parents:
diff changeset
253 function Add (Date : Time; Days : Long_Integer) return Time;
kono
parents:
diff changeset
254 -- Add a certain number of days to a time value
kono
parents:
diff changeset
255
kono
parents:
diff changeset
256 procedure Difference
kono
parents:
diff changeset
257 (Left : Time;
kono
parents:
diff changeset
258 Right : Time;
kono
parents:
diff changeset
259 Days : out Long_Integer;
kono
parents:
diff changeset
260 Seconds : out Duration;
kono
parents:
diff changeset
261 Leap_Seconds : out Integer);
kono
parents:
diff changeset
262 -- Calculate the difference between two time values in terms of days,
kono
parents:
diff changeset
263 -- seconds and leap seconds elapsed. The leap seconds are not included
kono
parents:
diff changeset
264 -- in the seconds returned. If Left is greater than Right, the returned
kono
parents:
diff changeset
265 -- values are positive, negative otherwise.
kono
parents:
diff changeset
266
kono
parents:
diff changeset
267 function Subtract (Date : Time; Days : Long_Integer) return Time;
kono
parents:
diff changeset
268 -- Subtract a certain number of days from a time value
kono
parents:
diff changeset
269
kono
parents:
diff changeset
270 end Arithmetic_Operations;
kono
parents:
diff changeset
271
kono
parents:
diff changeset
272 ---------------------------
kono
parents:
diff changeset
273 -- Conversion_Operations --
kono
parents:
diff changeset
274 ---------------------------
kono
parents:
diff changeset
275
kono
parents:
diff changeset
276 package Conversion_Operations is
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 function To_Ada_Time (Unix_Time : Long_Integer) return Time;
kono
parents:
diff changeset
279 -- Unix to Ada Epoch conversion
kono
parents:
diff changeset
280
kono
parents:
diff changeset
281 function To_Ada_Time
kono
parents:
diff changeset
282 (tm_year : Integer;
kono
parents:
diff changeset
283 tm_mon : Integer;
kono
parents:
diff changeset
284 tm_day : Integer;
kono
parents:
diff changeset
285 tm_hour : Integer;
kono
parents:
diff changeset
286 tm_min : Integer;
kono
parents:
diff changeset
287 tm_sec : Integer;
kono
parents:
diff changeset
288 tm_isdst : Integer) return Time;
kono
parents:
diff changeset
289 -- Struct tm to Ada Epoch conversion
kono
parents:
diff changeset
290
kono
parents:
diff changeset
291 function To_Duration
kono
parents:
diff changeset
292 (tv_sec : Long_Integer;
kono
parents:
diff changeset
293 tv_nsec : Long_Integer) return Duration;
kono
parents:
diff changeset
294 -- Struct timespec to Duration conversion
kono
parents:
diff changeset
295
kono
parents:
diff changeset
296 procedure To_Struct_Timespec
kono
parents:
diff changeset
297 (D : Duration;
kono
parents:
diff changeset
298 tv_sec : out Long_Integer;
kono
parents:
diff changeset
299 tv_nsec : out Long_Integer);
kono
parents:
diff changeset
300 -- Duration to struct timespec conversion
kono
parents:
diff changeset
301
kono
parents:
diff changeset
302 procedure To_Struct_Tm
kono
parents:
diff changeset
303 (T : Time;
kono
parents:
diff changeset
304 tm_year : out Integer;
kono
parents:
diff changeset
305 tm_mon : out Integer;
kono
parents:
diff changeset
306 tm_day : out Integer;
kono
parents:
diff changeset
307 tm_hour : out Integer;
kono
parents:
diff changeset
308 tm_min : out Integer;
kono
parents:
diff changeset
309 tm_sec : out Integer);
kono
parents:
diff changeset
310 -- Time to struct tm conversion
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 function To_Unix_Time (Ada_Time : Time) return Long_Integer;
kono
parents:
diff changeset
313 -- Ada to Unix Epoch conversion
kono
parents:
diff changeset
314
kono
parents:
diff changeset
315 end Conversion_Operations;
kono
parents:
diff changeset
316
kono
parents:
diff changeset
317 ----------------------
kono
parents:
diff changeset
318 -- Delay_Operations --
kono
parents:
diff changeset
319 ----------------------
kono
parents:
diff changeset
320
kono
parents:
diff changeset
321 package Delay_Operations is
kono
parents:
diff changeset
322
kono
parents:
diff changeset
323 function To_Duration (Date : Time) return Duration;
kono
parents:
diff changeset
324 -- Given a time value in nanoseconds since 1901, convert it into a
kono
parents:
diff changeset
325 -- duration value giving the number of nanoseconds since the Unix Epoch.
kono
parents:
diff changeset
326
kono
parents:
diff changeset
327 end Delay_Operations;
kono
parents:
diff changeset
328
kono
parents:
diff changeset
329 ---------------------------
kono
parents:
diff changeset
330 -- Formatting_Operations --
kono
parents:
diff changeset
331 ---------------------------
kono
parents:
diff changeset
332
kono
parents:
diff changeset
333 package Formatting_Operations is
kono
parents:
diff changeset
334
kono
parents:
diff changeset
335 function Day_Of_Week (Date : Time) return Integer;
kono
parents:
diff changeset
336 -- Determine which day of week Date falls on. The returned values are
kono
parents:
diff changeset
337 -- within the range of 0 .. 6 (Monday .. Sunday).
kono
parents:
diff changeset
338
kono
parents:
diff changeset
339 procedure Split
kono
parents:
diff changeset
340 (Date : Time;
kono
parents:
diff changeset
341 Year : out Year_Number;
kono
parents:
diff changeset
342 Month : out Month_Number;
kono
parents:
diff changeset
343 Day : out Day_Number;
kono
parents:
diff changeset
344 Day_Secs : out Day_Duration;
kono
parents:
diff changeset
345 Hour : out Integer;
kono
parents:
diff changeset
346 Minute : out Integer;
kono
parents:
diff changeset
347 Second : out Integer;
kono
parents:
diff changeset
348 Sub_Sec : out Duration;
kono
parents:
diff changeset
349 Leap_Sec : out Boolean;
kono
parents:
diff changeset
350 Use_TZ : Boolean;
kono
parents:
diff changeset
351 Is_Historic : Boolean;
kono
parents:
diff changeset
352 Time_Zone : Long_Integer);
kono
parents:
diff changeset
353 pragma Export (Ada, Split, "__gnat_split");
kono
parents:
diff changeset
354 -- Split a time value into its components. If flag Is_Historic is set,
kono
parents:
diff changeset
355 -- this routine would try to use to the best of the OS's abilities the
kono
parents:
diff changeset
356 -- time zone offset that was or will be in effect on Date. Set Use_TZ
kono
parents:
diff changeset
357 -- to use the local time zone (the value in Time_Zone is ignored) when
kono
parents:
diff changeset
358 -- splitting a time value.
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 function Time_Of
kono
parents:
diff changeset
361 (Year : Year_Number;
kono
parents:
diff changeset
362 Month : Month_Number;
kono
parents:
diff changeset
363 Day : Day_Number;
kono
parents:
diff changeset
364 Day_Secs : Day_Duration;
kono
parents:
diff changeset
365 Hour : Integer;
kono
parents:
diff changeset
366 Minute : Integer;
kono
parents:
diff changeset
367 Second : Integer;
kono
parents:
diff changeset
368 Sub_Sec : Duration;
kono
parents:
diff changeset
369 Leap_Sec : Boolean;
kono
parents:
diff changeset
370 Use_Day_Secs : Boolean;
kono
parents:
diff changeset
371 Use_TZ : Boolean;
kono
parents:
diff changeset
372 Is_Historic : Boolean;
kono
parents:
diff changeset
373 Time_Zone : Long_Integer) return Time;
kono
parents:
diff changeset
374 pragma Export (Ada, Time_Of, "__gnat_time_of");
kono
parents:
diff changeset
375 -- Given all the components of a date, return the corresponding time
kono
parents:
diff changeset
376 -- value. Set Use_Day_Secs to use the value in Day_Secs, otherwise the
kono
parents:
diff changeset
377 -- day duration will be calculated from Hour, Minute, Second and Sub_
kono
parents:
diff changeset
378 -- Sec. If flag Is_Historic is set, this routine would try to use to the
kono
parents:
diff changeset
379 -- best of the OS's abilities the time zone offset that was or will be
kono
parents:
diff changeset
380 -- in effect on the input date. Set Use_TZ to use the local time zone
kono
parents:
diff changeset
381 -- (the value in formal Time_Zone is ignored) when building a time value
kono
parents:
diff changeset
382 -- and to verify the validity of a requested leap second.
kono
parents:
diff changeset
383
kono
parents:
diff changeset
384 end Formatting_Operations;
kono
parents:
diff changeset
385
kono
parents:
diff changeset
386 ---------------------------
kono
parents:
diff changeset
387 -- Time_Zones_Operations --
kono
parents:
diff changeset
388 ---------------------------
kono
parents:
diff changeset
389
kono
parents:
diff changeset
390 package Time_Zones_Operations is
kono
parents:
diff changeset
391
kono
parents:
diff changeset
392 function UTC_Time_Offset (Date : Time) return Long_Integer;
kono
parents:
diff changeset
393 -- Return (in seconds) the difference between the local time zone and
kono
parents:
diff changeset
394 -- UTC time at a specific historic date.
kono
parents:
diff changeset
395
kono
parents:
diff changeset
396 end Time_Zones_Operations;
kono
parents:
diff changeset
397
kono
parents:
diff changeset
398 end Ada.Calendar;