1 ------------------------------------------------------------------------------
3 -- GNAT RUNTIME COMPONENTS --
5 -- A D A . C A L E N D A R --
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. --
15 ------------------------------------------------------------------------------
17 -- This is the Alpha/VMS version.
19 with System.OS_Primitives;
20 package Ada.Calendar is
22 package OSP renames System.OS_Primitives;
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).
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;
34 subtype Day_Duration is Duration range 0.0 .. 86_400.0;
36 function Clock return Time;
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;
45 Year : out Year_Number;
46 Month : out Month_Number;
48 Seconds : out Day_Duration);
54 Seconds : Day_Duration := 0.0)
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;
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;
67 Time_Error : exception;
71 pragma Inline (Clock);
74 pragma Inline (Month);
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).
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.
94 type Time is new OSP.OS_Time;
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.