< previous page page_161 next page >

Page 161
6.2.3.1.2.2.3
easter_julian ()
This routine (Listing 6.16) returns the date for Western Easter on a given year in the Julian calendar system for dates after A.D. 463. This date is not the Eastern Easter of the Eastern Orthodox churches.
6.2.3.1.2.2.4
easter_gregorian_meeus ()
This Gregorian Easter routine (Listing 6.17) is given by Jean Meeus in his book Astronomical Algorithms. It is valid for all Gregorian years; that is, years > 1582.
(continued)
Listing 6.15
/* The value of 'e' may be negative. The case of year = 14250, e.g.,
   produces values of g = 1, z = 40 and x = 95. The value of el is thus
   -24, and the 'mod' code fails to return the proper positive result.
   The following correction produces a positive value, mod 30, for 'e'.
*/


   while (e < 0L)
         e += 30L;


   if ( ((e == 25L) && (g > 11)) || (e == 24L) )
      e++;


   n = 44L - e;


   if (n < 21L)
      n += 30L;


   dpn = d + n;
   nl = dpn - ((dpn / 7L) * 7L);
   n = n + 7L - nl;


   if (n > 31L)
      {
      date.month = 4;
      date.day = (int) (n - 31L);
      }
   else
      {
      date.month = 3;
      date.day = (int) n;
      }


   date.year = year;


   return (date);
}



 
< previous page page_161 next page >