* options.c (gfc_handle_module_path_options): Fix buffer overrun.
[official-gcc.git] / gcc / ada / a-calend.ads
blob00d45321037549d0422192ece3f85dfe45dd2b7a
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- A D A . C A L E N D A R --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 1992-1997 Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
24 -- MA 02111-1307, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
35 -- --
36 ------------------------------------------------------------------------------
38 package Ada.Calendar is
40 type Time is private;
42 -- Declarations representing limits of allowed local time values. Note that
43 -- these do NOT constrain the possible stored values of time which may well
44 -- permit a larger range of times (this is explicitly allowed in Ada 95).
46 subtype Year_Number is Integer range 1901 .. 2099;
47 subtype Month_Number is Integer range 1 .. 12;
48 subtype Day_Number is Integer range 1 .. 31;
50 subtype Day_Duration is Duration range 0.0 .. 86_400.0;
52 function Clock return Time;
54 function Year (Date : Time) return Year_Number;
55 function Month (Date : Time) return Month_Number;
56 function Day (Date : Time) return Day_Number;
57 function Seconds (Date : Time) return Day_Duration;
59 procedure Split
60 (Date : Time;
61 Year : out Year_Number;
62 Month : out Month_Number;
63 Day : out Day_Number;
64 Seconds : out Day_Duration);
66 function Time_Of
67 (Year : Year_Number;
68 Month : Month_Number;
69 Day : Day_Number;
70 Seconds : Day_Duration := 0.0)
71 return Time;
73 function "+" (Left : Time; Right : Duration) return Time;
74 function "+" (Left : Duration; Right : Time) return Time;
75 function "-" (Left : Time; Right : Duration) return Time;
76 function "-" (Left : Time; Right : Time) return Duration;
78 function "<" (Left, Right : Time) return Boolean;
79 function "<=" (Left, Right : Time) return Boolean;
80 function ">" (Left, Right : Time) return Boolean;
81 function ">=" (Left, Right : Time) return Boolean;
83 Time_Error : exception;
85 private
86 pragma Inline (Clock);
88 pragma Inline (Year);
89 pragma Inline (Month);
90 pragma Inline (Day);
92 pragma Inline ("+");
93 pragma Inline ("-");
95 pragma Inline ("<");
96 pragma Inline ("<=");
97 pragma Inline (">");
98 pragma Inline (">=");
100 -- Time is represented as a signed duration from the base point which is
101 -- what Unix calls the EPOCH (i.e. 12 midnight (24:00:00), Dec 31st, 1969,
102 -- or if you prefer 0:00:00 on Jan 1st, 1970). Since Ada allows dates
103 -- before this EPOCH value, the stored duration value may be negative.
105 -- The time value stored is typically a GMT value, as provided in standard
106 -- Unix environments. If this is the case then Split and Time_Of perform
107 -- required conversions to and from local times. The range of times that
108 -- can be stored in Time values depends on the declaration of the type
109 -- Duration, which must at least cover the required Ada range represented
110 -- by the declaration of Year_Number, but may be larger (we take full
111 -- advantage of the new permission in Ada 95 to store time values outside
112 -- the range that would be acceptable to Split). The Duration type is a
113 -- real value representing a time interval in seconds.
115 type Time is new Duration;
117 end Ada.Calendar;