|
|
|
|
|
|
|
#include "scdtl_2.h"
struct DATE_INFO christ_the_king_protestant (int year)
{
int stop;
double jd;
struct DATE_INFO date;
date.year = year;
date.month = 8;
date.day = 31;
stop = 0;
while (stop == 0)
{
jd = date_to_JD0 (&date);
if (day_of_week_index_JD0 (jd) == DOW_SUNDAY)
stop = 1;
else
date.day--;
}
return (date);
} |
|
|
|
|
|
|
|
|
A second possible approach reduces source code length and improves maintainability, at the expense of some run time, by using the utility function ensemble. This approach is illustrated for the Roman Catholic version of this day, as follows: |
|
|
|
|
|
|
|
|
#include "scdtl_2.h"
struct DATE_INFO christ_the_king_catholic (int year)
{
int n;
struct DATE_INFO date;
n = number_of_DOWs_in_month (DOW_SUNDAY, MONTH_OCTOBER, year);
date = Nth_DOW_of_month (n, DOW_SUNDAY, MONTH_OCTOBER, year);
return (date);
} |
|
|
|
|
|
|
|
|
6.2.2.4
Closest DOW to Date |
|
|
|
|
|
|
|
|
The best known example for this rule is Advent Sunday. |
|
|
|
|
|
|
|
|
The date for the First Sunday of Advent is celebrated on the Sunday which is closest to 30 November. The term Advent comes from the Latin adventus, or coming, of Christ and refers to the ecclesiastical season immediately before Christmas. It is celebrated on the Sunday of, or nearest to, Saint Andrew's Day, 30 November, thus ensuring that four Sundays always precede Christmas. For the Eastern Church, Advent is longer, beginning in mid-November. The first Sunday in Advent, or Advent Sunday, |
|
|
|
|
|