|
|
|
|
|
|
|
6.2.3.1.2.2.9 easter_gauss () |
|
|
|
|
|
|
|
|
This routine (Listing 6.22) implements Gauss' Easter Sunday algorithm. This is a quick routine with limited input range. |
|
|
|
|
|
|
|
|
6.2.3.2
Days Defined by Easter |
|
|
|
|
|
|
|
|
Many days of observance are tied to the definition of Easter. Altogether, these days occupy over 100 days, or almost one-third of the entire year, making the Easter cycle easily the longest series of related days of observance in the Western calendar. |
|
|
|
|
|
|
|
|
All of these days are, in effect, defined as occurring a constant number of days before or after Easter. Good Friday, for example, is the Friday before Easter Sunday, and thus occurs two days before Easter. Easter Monday is the Monday following Easter Sunday, and thus occurs one day after Easter. |
|
|
|
|
|
|
|
|
Therefore, any day of observance defined in terms of a fixed number of days before or after Easter can be calculated by calculating the date of Easter then simply |
|
|
|
|
| Listing 6.21 | |
|
|
|
|
#include "dateinfo.h"
struct DATE_INFO easter_oudin (int year)
{
long c, n, y, k, i, j, x, m, d;
struct DATE_INFO date;
date.year =0;
date.month =0;
date.day =0;
if (year < 1583)
return (date);
y = (long) year;
c = y / 100L;
n = y - 19L * (y / 19L);
k = (c - 17L) / 25L;
i = c - c / 4L - (c - k) / 3L + 19L * n + 15L;
i = i - 30L * (i / 30L);
i = i - (i / 28L) * (1L - (i / 28L) * (29L / (i + 1L)) * ((21L - n) / 11L));
j = y + y / 4L + i + 2L - c + c / 4L;
j = j - 7L * (j / 7L);
x = i - j;
m = 3L + (x + 40L) / 44L;
d = x + 28L - 31L * (m / 4L);
date.year = (int) y;
date.month = (int) m;
date.day = (int) d;
return (date);
}
|
|
|
|
|
|
|
|