* config/xtensa/xtensa.h (GO_IF_MODE_DEPENDENT_ADDRESS): Treat
[official-gcc.git] / gcc / ada / g-calend.ads
blob38d853f25348b3e9db0c250676c900e4b5b56e6d
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT RUN-TIME COMPONENTS --
4 -- --
5 -- G N A T . C A L E N D A R --
6 -- --
7 -- S p e c --
8 -- --
9 -- --
10 -- Copyright (C) 1999-2001 Free Software Foundation, Inc. --
11 -- --
12 -- GNAT is free software; you can redistribute it and/or modify it under --
13 -- terms of the GNU General Public License as published by the Free Soft- --
14 -- ware Foundation; either version 2, or (at your option) any later ver- --
15 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
16 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
17 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
18 -- for more details. You should have received a copy of the GNU General --
19 -- Public License distributed with GNAT; see file COPYING. If not, write --
20 -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
21 -- MA 02111-1307, USA. --
22 -- --
23 -- As a special exception, if other files instantiate generics from this --
24 -- unit, or you link this unit with other files to produce an executable, --
25 -- this unit does not by itself cause the resulting executable to be --
26 -- covered by the GNU General Public License. This exception does not --
27 -- however invalidate any other reasons why the executable file might be --
28 -- covered by the GNU Public License. --
29 -- --
30 -- GNAT was originally developed by the GNAT team at New York University. --
31 -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
32 -- --
33 ------------------------------------------------------------------------------
35 -- This package extends Ada.Calendar to handle Hour, Minute, Second,
36 -- Second_Duration and Day_Of_Week and Day_In_Year from Calendar.Time.
37 -- Second_Duration precision depends on the target clock precision.
39 -- GNAT.Calendar provides the same kind of abstraction found in
40 -- Ada.Calendar. It provides Split and Time_Of to build and split a Time
41 -- data. And it provides accessor functions to get only one of Hour, Minute,
42 -- Second, Second_Duration. Other functions are to access more advanced
43 -- valueas like Day_Of_Week, Day_In_Year and Week_In_Year.
45 with Ada.Calendar;
46 with Interfaces.C;
48 package GNAT.Calendar is
50 type Day_Name is
51 (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
53 subtype Hour_Number is Natural range 0 .. 23;
54 subtype Minute_Number is Natural range 0 .. 59;
55 subtype Second_Number is Natural range 0 .. 59;
56 subtype Second_Duration is Ada.Calendar.Day_Duration range 0.0 .. 1.0;
57 subtype Day_In_Year_Number is Positive range 1 .. 366;
58 subtype Week_In_Year_Number is Positive range 1 .. 53;
60 function Hour (Date : Ada.Calendar.Time) return Hour_Number;
61 function Minute (Date : Ada.Calendar.Time) return Minute_Number;
62 function Second (Date : Ada.Calendar.Time) return Second_Number;
63 function Sub_Second (Date : Ada.Calendar.Time) return Second_Duration;
64 -- Hour, Minute, Sedond and Sub_Second returns the complete time data for
65 -- the Date (H:M:S.SS). See Ada.Calendar for Year, Month, Day accessors.
66 -- Second_Duration precision depends on the target clock precision.
68 function Day_Of_Week (Date : Ada.Calendar.Time) return Day_Name;
69 -- Return the day name.
71 function Day_In_Year (Date : Ada.Calendar.Time) return Day_In_Year_Number;
72 -- Returns the day number in the year. (1st January is day 1 and 31st
73 -- December is day 365 or 366 for leap year).
75 function Week_In_Year (Date : Ada.Calendar.Time) return Week_In_Year_Number;
76 -- Returns the week number in the year with Monday as first day of week
78 procedure Split
79 (Date : Ada.Calendar.Time;
80 Year : out Ada.Calendar.Year_Number;
81 Month : out Ada.Calendar.Month_Number;
82 Day : out Ada.Calendar.Day_Number;
83 Hour : out Hour_Number;
84 Minute : out Minute_Number;
85 Second : out Second_Number;
86 Sub_Second : out Second_Duration);
87 -- Split the standard Ada.Calendar.Time data in date data (Year, Month,
88 -- Day) and Time data (Hour, Minute, Second, Sub_Second)
90 function Time_Of
91 (Year : Ada.Calendar.Year_Number;
92 Month : Ada.Calendar.Month_Number;
93 Day : Ada.Calendar.Day_Number;
94 Hour : Hour_Number;
95 Minute : Minute_Number;
96 Second : Second_Number;
97 Sub_Second : Second_Duration := 0.0)
98 return Ada.Calendar.Time;
99 -- Returns an Ada.Calendar.Time data built from the date and time values.
101 -- C timeval conversion
103 -- C timeval represent a duration (used in Select for example). This
104 -- structure is composed of a number of seconds and a number of micro
105 -- seconds. The timeval structure is not exposed here because its
106 -- definition is target dependent. Interface to C programs is done via a
107 -- pointer to timeval structure.
109 type timeval is private;
111 function To_Duration (T : access timeval) return Duration;
112 function To_Timeval (D : Duration) return timeval;
114 private
115 -- This is a dummy declaration that should be the largest possible timeval
116 -- structure of all supported targets.
118 type timeval is array (1 .. 2) of Interfaces.C.long;
120 function Julian_Day
121 (Year : Ada.Calendar.Year_Number;
122 Month : Ada.Calendar.Month_Number;
123 Day : Ada.Calendar.Day_Number)
124 return Integer;
125 -- Compute Julian day number.
127 -- The code of this function is a modified version of algorithm
128 -- 199 from the Collected Algorithms of the ACM.
129 -- The author of algorithm 199 is Robert G. Tantzen.
130 end GNAT.Calendar;