OSDN Git Service

2007-01-26 Andrew Haley <aph@redhat.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / a-calfor.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUN-TIME COMPONENTS                         --
4 --                                                                          --
5 --              A D A . C A L E N D A R . F O R M A T T I N G               --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --        Copyright (C) 2005 - 2006, 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 ------------------------------------------------------------------------------
37
38 with Ada.Calendar.Time_Zones;
39
40 package Ada.Calendar.Formatting is
41
42    --  Day of the week
43
44    type Day_Name is
45      (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
46
47    function Day_Of_Week (Date : Time) return Day_Name;
48
49    --  Hours:Minutes:Seconds access
50
51    subtype Hour_Number     is Natural range 0 .. 23;
52    subtype Minute_Number   is Natural range 0 .. 59;
53    subtype Second_Number   is Natural range 0 .. 59;
54    subtype Second_Duration is Day_Duration range 0.0 .. 1.0;
55
56    function Year
57      (Date      : Time;
58       Time_Zone : Time_Zones.Time_Offset := 0) return Year_Number;
59
60    function Month
61      (Date      : Time;
62       Time_Zone : Time_Zones.Time_Offset := 0) return Month_Number;
63
64    function Day
65      (Date      : Time;
66       Time_Zone : Time_Zones.Time_Offset := 0) return Day_Number;
67
68    function Hour
69      (Date      : Time;
70       Time_Zone : Time_Zones.Time_Offset := 0) return Hour_Number;
71
72    function Minute
73      (Date      : Time;
74       Time_Zone : Time_Zones.Time_Offset := 0) return Minute_Number;
75
76    function Second
77      (Date : Time)                             return Second_Number;
78
79    function Sub_Second
80      (Date : Time)                             return Second_Duration;
81
82    function Seconds_Of
83      (Hour       : Hour_Number;
84       Minute     : Minute_Number;
85       Second     : Second_Number := 0;
86       Sub_Second : Second_Duration := 0.0) return Day_Duration;
87
88    procedure Split
89      (Seconds    : Day_Duration;
90       Hour       : out Hour_Number;
91       Minute     : out Minute_Number;
92       Second     : out Second_Number;
93       Sub_Second : out Second_Duration);
94
95    procedure Split
96      (Date       : Time;
97       Year       : out Year_Number;
98       Month      : out Month_Number;
99       Day        : out Day_Number;
100       Hour       : out Hour_Number;
101       Minute     : out Minute_Number;
102       Second     : out Second_Number;
103       Sub_Second : out Second_Duration;
104       Time_Zone  : Time_Zones.Time_Offset := 0);
105
106    function Time_Of
107      (Year        : Year_Number;
108       Month       : Month_Number;
109       Day         : Day_Number;
110       Hour        : Hour_Number;
111       Minute      : Minute_Number;
112       Second      : Second_Number;
113       Sub_Second  : Second_Duration := 0.0;
114       Leap_Second : Boolean := False;
115       Time_Zone   : Time_Zones.Time_Offset := 0) return Time;
116
117    function Time_Of
118      (Year        : Year_Number;
119       Month       : Month_Number;
120       Day         : Day_Number;
121       Seconds     : Day_Duration := 0.0;
122       Leap_Second : Boolean := False;
123       Time_Zone   : Time_Zones.Time_Offset := 0) return Time;
124
125    procedure Split
126      (Date        : Time;
127       Year        : out Year_Number;
128       Month       : out Month_Number;
129       Day         : out Day_Number;
130       Hour        : out Hour_Number;
131       Minute      : out Minute_Number;
132       Second      : out Second_Number;
133       Sub_Second  : out Second_Duration;
134       Leap_Second : out Boolean;
135       Time_Zone   : Time_Zones.Time_Offset := 0);
136
137    procedure Split
138      (Date        : Time;
139       Year        : out Year_Number;
140       Month       : out Month_Number;
141       Day         : out Day_Number;
142       Seconds     : out Day_Duration;
143       Leap_Second : out Boolean;
144       Time_Zone   : Time_Zones.Time_Offset := 0);
145
146    --  Simple image and value
147
148    function Image
149      (Date                  : Time;
150       Include_Time_Fraction : Boolean := False;
151       Time_Zone             : Time_Zones.Time_Offset := 0) return String;
152
153    function Value
154      (Date       : String;
155       Time_Zone  : Time_Zones.Time_Offset := 0) return Time;
156
157    function Image
158      (Elapsed_Time          : Duration;
159       Include_Time_Fraction : Boolean := False) return String;
160
161    function Value (Elapsed_Time : String) return Duration;
162
163 end Ada.Calendar.Formatting;