|
|
|
| Listing 6.14 easter () | |
|
|
|
|
/* easter.c
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Returns the date for 'Western Easter' on a given year in either the Julian
calendar system, or the Gregorian calendar system, for dates after A.D. 463.
This date is not the 'Eastern Easter' of the Eastern Orthodox churches.
The algorithms are based upon an ALGOL procedure by Donald Knuth in
CACM, v5, (1962), pp 209210, and 'Fundamental Algorithms', pp 155156,
by the same author.
INPUTS:
1. year, type int. Assumed to be a complete year, not an abbreviated 2-digit
year. Valid inputs range from 464 to 32767, assuming a 16-bit integer.
OUTPUTS:
1. returned by routine, a DATE_INFO structure containing the date on
which Easter falls for the indicated year.
NOTES:
1. Easter is defined as the 'first Sunday following the first
ecclesiastical full moon which occurs on, or after, March 21'.
2. This routine is simply a switch, which calls the appropriate Easter
algorithm, depending upon year.
3. This routine does not validate the year for the input range. In
particular, it does not check for years prior to A.D. 463.
*/
#include "scdtl_1.h"
#include "scdtl_4.h"
struct DATE_INFO easter (int year)
{
if (year <= 1582)
return (easter_julian (year));
else
return (easter_gregorian (year));
}
|
|
|
|
|
|
|
| Listing 6.15 easter_gregorian () | |
|
|
|
|
/* easter_g.c
+-------------------------------------------+
| Copyright (C) 1995 by Lance W. Latham. |
| All rights reserved. |
+-------------------------------------------+
Returns the date for 'Western Easter' on a given year in the Gregorian calendar
system. This is not the 'Eastern Easter' of the Eastern Orthodox churches.
INPUTS:
1. year, type int. Assumed to be a complete year, not an abbreviated
2-digit year. Valid inputs range from 1583 to 32767, assuming a 16-bit
integer. Knuth states that the algorithm is used "for any year after 1582".
|
|
|
|
|
|
|
|