OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / ada / 4vcalend.ads
1 ------------------------------------------------------------------------------
2 --                                                                          --
3 --                         GNAT RUNTIME COMPONENTS                          --
4 --                                                                          --
5 --                         A D A . C A L E N D A R                          --
6 --                                                                          --
7 --                                 S p e c                                  --
8 --                                                                          --
9 --                                                                          --
10 -- This specification is adapted from the Ada Reference Manual for use with --
11 -- GNAT.  In accordance with the copyright of that document, you can freely --
12 -- copy and modify this specification,  provided that if you redistribute a --
13 -- modified version,  any changes that you have made are clearly indicated. --
14 --                                                                          --
15 ------------------------------------------------------------------------------
16
17 --  This is the Alpha/VMS version.
18
19 with System.OS_Primitives;
20 package Ada.Calendar is
21
22    package OSP renames System.OS_Primitives;
23
24    type Time is private;
25
26    --  Declarations representing limits of allowed local time values. Note that
27    --  these do NOT constrain the possible stored values of time which may well
28    --  permit a larger range of times (this is explicitly allowed in Ada 95).
29
30    subtype Year_Number  is Integer range 1901 .. 2099;
31    subtype Month_Number is Integer range 1 .. 12;
32    subtype Day_Number   is Integer range 1 .. 31;
33
34    subtype Day_Duration is Duration range 0.0 .. 86_400.0;
35
36    function Clock return Time;
37
38    function Year    (Date : Time) return Year_Number;
39    function Month   (Date : Time) return Month_Number;
40    function Day     (Date : Time) return Day_Number;
41    function Seconds (Date : Time) return Day_Duration;
42
43    procedure Split
44      (Date    : Time;
45       Year    : out Year_Number;
46       Month   : out Month_Number;
47       Day     : out Day_Number;
48       Seconds : out Day_Duration);
49
50    function Time_Of
51      (Year    : Year_Number;
52       Month   : Month_Number;
53       Day     : Day_Number;
54       Seconds : Day_Duration := 0.0)
55       return    Time;
56
57    function "+" (Left : Time;     Right : Duration) return Time;
58    function "+" (Left : Duration; Right : Time)     return Time;
59    function "-" (Left : Time;     Right : Duration) return Time;
60    function "-" (Left : Time;     Right : Time)     return Duration;
61
62    function "<"  (Left, Right : Time) return Boolean;
63    function "<=" (Left, Right : Time) return Boolean;
64    function ">"  (Left, Right : Time) return Boolean;
65    function ">=" (Left, Right : Time) return Boolean;
66
67    Time_Error : exception;
68
69 private
70
71    pragma Inline (Clock);
72
73    pragma Inline (Year);
74    pragma Inline (Month);
75    pragma Inline (Day);
76
77    pragma Inline ("+");
78    pragma Inline ("-");
79
80    pragma Inline ("<");
81    pragma Inline ("<=");
82    pragma Inline (">");
83    pragma Inline (">=");
84
85    --  Time is represented as the number of 100-nanosecond (ns) units offset
86    --  from the system base date and time, which is 00:00 o'clock,
87    --  November 17, 1858 (the Smithsonian base date and time for the
88    --  astronomic calendar).
89
90    --  The time value stored is typically a GMT value, as provided in standard
91    --  Unix environments. If this is the case then Split and Time_Of perform
92    --  required conversions to and from local times.
93
94    type Time is new OSP.OS_Time;
95
96    --  Notwithstanding this definition, Time is not quite the same as OS_Time.
97    --  Relative Time is positive, whereas relative OS_Time is negative,
98    --  but this declaration makes for easier conversion.
99
100 end Ada.Calendar;