< previous page page_121 next page >

Page 121
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
int i;
int table [5] = {1912, 1932, 1958, 1969, 1972};
for (i = 0; i < 5; i++)
    {
    if (year == table [i])
        date = foo_day (year);
    }
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
1.2.) Implicit fixed date.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
1.2.1.) Period of less than one year. The approach chosen depends upon the application and time of year. Using the example of Fatima again, and assuming the need to know the start date and end date of the pilgrimage in May, two solution methods are possible:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
If no intercalary day can intervene, use of the fixed date is simpler and produces faster execution. Assuming the two dates are always separated by a constant number of days would result in:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
date1 = fatima_may_start (year);
date2 = fatima_may_end (year);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
In cases where an intercalary day can intervene, or the number of days between the dates is variable but known, calculate the second date:
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
int n;
date1 = fatima_may_start (year);
date2 = date_N_days_after_date (n, &date1);
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
1.2.2.) Period of one year. Use of the fixed-date rule is, again, preferable in those situations where an intercalary day cannot intervene and the number of days between the two dates is constant.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
It is possible, for example, to define Epiphany as Christmas plus 12 days or simply as 6 January. The latter rule is simpler, faster in execution, and avoids potential maintenance problems.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
1.2.3.) Period of greater than one year. The same considerations as those for section 1.1.3. apply.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
1.2.4.) Irregular period. The same considerations as those for section 1.1.4. apply.
2.) Movable feasts.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
2.1.) The Nth DOW of a fixed month.
b6d2bb65dfd7651e7b7c6e77bcdb2d67.gif
2.1.1.) N is fixed by value. Use the Nth-DOW rule. The example of Hurling the Silver Ball on the first Monday in February produces:

 
< previous page page_121 next page >