1
-------------------------------------------------------------------------------
3
-- <STRONG>Copyright © 2001, 2002 by Thomas Wolf.</STRONG>
5
-- This piece of software is free software; you can redistribute it and/or
6
-- modify it under the terms of the GNU General Public License as published
7
-- by the Free Software Foundation; either version 2, or (at your option)
8
-- any later version. This software is distributed in the hope that it will
9
-- be useful, but <EM>without any warranty</EM>; without even the implied
10
-- warranty of <EM>merchantability or fitness for a particular purpose.</EM>
11
-- See the GNU General Public License for more details. You should have
12
-- received a copy of the GNU General Public License with this distribution,
13
-- see file "<A HREF="GPL.txt">GPL.txt</A>". If not, write to the Free
14
-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18
-- As a special exception from the GPL, if other files instantiate generics
19
-- from this unit, or you link this unit with other files to produce an
20
-- executable, this unit does not by itself cause the resulting executable
21
-- to be covered by the GPL. This exception does not however invalidate any
22
-- other reasons why the executable file might be covered by the GPL.
26
-- Thomas Wolf (TW) <E_MAIL>
30
-- Root package of the calendar subsystem. Provides a day-of-week
31
-- calculation for Gregorian dates.
34
-- <DL><DT><STRONG>Literature:</STRONG><DD>
35
-- <P>See Christian Zeller; <EM>Kalender-Formeln</EM>, Acta Mathematica, vol.
36
-- <STRONG>9</STRONG>, pp. 131-136; Nov. 1886. (Yes, that's <EM>not</EM>
37
-- a typo, it really appeared in eighteen-eightysix. In fact, that paper
38
-- is an expanded version of an earlier one from 1883!)
40
-- <A HREF="http://www.merlyn.demon.co.uk/zeller-c.htm">J.R. Stockton's page
41
-- on Zeller's congruence</A>.</DL>
44
-- 29-JUL-2002 TW Initial version.
45
-- 28-OCT-2002 TW Added 'Split'.
47
-------------------------------------------------------------------------------
49
pragma License (Modified_GPL);
53
package Util.Calendar is
55
pragma Elaborate_Body;
56
-- Can't be pure, because Ada.Calendar isn't pure.
58
type Weekday is (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
61
(Year : in Ada.Calendar.Year_Number;
62
Month : in Ada.Calendar.Month_Number;
63
Day : in Ada.Calendar.Day_Number)
67
(Date : in Ada.Calendar.Time)
69
-- Returns the day of the week. Works for all Gregorian dates. Provided
70
-- here because it makes available this functionality for standard
71
-- Ada.Calendar times without dragging in all the extended calendar
74
type Hours_Type is new Natural range 0 .. 23;
75
type Minutes_Type is new Natural range 0 .. 59;
76
type Seconds_Type is new Natural range 0 .. 59;
79
(Secs : in Ada.Calendar.Day_Duration;
81
Min : out Minutes_Type;
82
Sec : out Seconds_Type;
83
Frac : out Ada.Calendar.Day_Duration);
84
-- Split a number of seconds @Secs@ into hours, minutes, seconds, and a
85
-- sub-second fraction.