Package: Util.Calendars.Julian

Dependencies

with Util.Calendars.Western;
with Util.Times;

Description

Copyright © 2001, 2002 by Thomas Wolf.
This piece of software is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This software is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License with this distribution, see file "GPL.txt". If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception from the GPL, if other files instantiate generics from this unit, or you link this unit with other files to produce an executable, this unit does not by itself cause the resulting executable to be covered by the GPL. This exception does not however invalidate any other reasons why the executable file might be covered by the GPL.

Version: 1.1

Author:
Thomas Wolf (TW) <twolf AT acm DOT org>
Purpose:
This is a proleptic Julian calendar. The Julian calendar had been introduced by Julius Caesar in 46 B.C. and been in use since 45 B.C.

This is a proleptic calendar: it extends to dates before 45 B.C.

Although every fourth year in the Julian calendar is a leap year, a counting error made every third year between 45 B.C. and 9 B.C. a leap year, which was corrected by not having leap years from 8 B.C. until 8 A.D., which again was a leap year. This implementation does not account for that, which means that between 45 B.C. and 7 A.D. the leap years do not match the real years. (We correct the Romans' counting error.)

Note that there was no year 0! The value 0 signifies 1 B.C., -1 is 2 B.C., and so on.

Tasking Semantics
Neither task- nor abortion-safe.
Storage Semantics
No dynamic storage allocation.

Header

package Util.Calendars.Julian is
 

Exceptions

Date_Error renames Util.Calendars.Date_Error

Type Summary

Calendar derived from Calendar
Overridden Operations:  Date, Day_Of_Week, Easter, Is_Leap_Year, Julian_Day
Inherited Operations:  Add_Months, Day, Day_In_Year, Image, Image, Is_Leap_Year, Month, Split, Split, Sub_Months, Time_Of, Time_Of, Year

Other Items:

type Calendar is new Util.Calendars.Western.Calendar with null record;

subtype Year_Number  is Util.Calendars.Western.Year_Number;

subtype Month_Number is Util.Calendars.Western.Month_Number;

subtype Day_Number   is Util.Calendars.Western.Day_Number;

function Is_Leap_Year
  (Base : in Calendar;
   Year : in Year_Number)
  return Boolean;
Conversion routines.

function Julian_Day
  (Base  : in Calendar;
   Year  : in Year_Number;
   Month : in Util.Calendars.Western.Month_Number;
   Day   : in Util.Calendars.Western.Day_Number)
  return Util.Times.Julian_Day_Number;

procedure Date
  (Base       : in     Calendar;
   Julian_Day : in     Util.Times.Julian_Day_Number;
   Year       :    out Year_Number;
   Month      :    out Util.Calendars.Western.Month_Number;
   Day        :    out Util.Calendars.Western.Day_Number);
Week days

function Day_Of_Week
  (Base : in Calendar;
   Date : in Util.Times.Time)
  return Util.Calendars.Western.Week_Day;
Easter date

function Easter
  (Base : in Calendar;
   Year : in Year_Number)
  return Util.Times.Time;
Returns midnight on easter in the given year. Raises Date_Error if Year < 326. (The easter calculations have been standardized only in 325 A.D. at the concil of Nicea.)
end Util.Calendars.Julian;