1 ------------------------------------------------------------------------------
3 -- GNAT RUNTIME COMPONENTS --
5 -- A D A . C A L E N D A R --
11 -- This specification is adapted from the Ada Reference Manual for use with --
12 -- GNAT. In accordance with the copyright of that document, you can freely --
13 -- copy and modify this specification, provided that if you redistribute a --
14 -- modified version, any changes that you have made are clearly indicated. --
16 ------------------------------------------------------------------------------
18 -- This is the Alpha/VMS version.
20 with System
.OS_Primitives
;
21 package Ada
.Calendar
is
23 package OSP
renames System
.OS_Primitives
;
27 -- Declarations representing limits of allowed local time values. Note that
28 -- these do NOT constrain the possible stored values of time which may well
29 -- permit a larger range of times (this is explicitly allowed in Ada 95).
31 subtype Year_Number
is Integer range 1901 .. 2099;
32 subtype Month_Number
is Integer range 1 .. 12;
33 subtype Day_Number
is Integer range 1 .. 31;
35 subtype Day_Duration
is Duration range 0.0 .. 86_400
.0
;
37 function Clock
return Time
;
39 function Year
(Date
: Time
) return Year_Number
;
40 function Month
(Date
: Time
) return Month_Number
;
41 function Day
(Date
: Time
) return Day_Number
;
42 function Seconds
(Date
: Time
) return Day_Duration
;
46 Year
: out Year_Number
;
47 Month
: out Month_Number
;
49 Seconds
: out Day_Duration
);
55 Seconds
: Day_Duration
:= 0.0)
58 function "+" (Left
: Time
; Right
: Duration) return Time
;
59 function "+" (Left
: Duration; Right
: Time
) return Time
;
60 function "-" (Left
: Time
; Right
: Duration) return Time
;
61 function "-" (Left
: Time
; Right
: Time
) return Duration;
63 function "<" (Left
, Right
: Time
) return Boolean;
64 function "<=" (Left
, Right
: Time
) return Boolean;
65 function ">" (Left
, Right
: Time
) return Boolean;
66 function ">=" (Left
, Right
: Time
) return Boolean;
68 Time_Error
: exception;
72 pragma Inline
(Clock
);
75 pragma Inline
(Month
);
86 -- Time is represented as the number of 100-nanosecond (ns) units offset
87 -- from the system base date and time, which is 00:00 o'clock,
88 -- November 17, 1858 (the Smithsonian base date and time for the
89 -- astronomic calendar).
91 -- The time value stored is typically a GMT value, as provided in standard
92 -- Unix environments. If this is the case then Split and Time_Of perform
93 -- required conversions to and from local times.
95 type Time
is new OSP
.OS_Time
;
97 -- Notwithstanding this definition, Time is not quite the same as OS_Time.
98 -- Relative Time is positive, whereas relative OS_Time is negative,
99 -- but this declaration makes for easier conversion.