< previous page page_152 next page >

Page 152
6.2.3.1.2.1.3.1
epact ()
This routine (Listing 6.9) returns the value of epact for a given year in the Julian or Gregorian calendar systems.
6.2.3.1.2.1.3.2
epact_gregorian ()
This routine (Listing 6.10) returns the value of epact for a given year in the Gregorian calendar system.
Listing 6.9 epact ()
/* epact.c
   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+
   Returns the value of 'epact' for a given year in the Julian or
   Gregorian calendar systems.


   INPUTS:
   1. year, type int. Assumed to be a complete year, not an abbreviated
      2-digit year. Valid inputs range from 1 to 32767, assuming a 16-bit integer.


   OUTPUTS:
   1. Returned by routine, type int, the value of epact for the given year.
      Valid values for epact are 1  30. See the 'epact_julian ()' and
      'epact_gregorian ()' routines for details.


   NOTES:
   1. The word 'epact' comes from the Greek 'epaktos', meaning 'brought in'.
      The term may signify either:


      1.1. the excess of days in the solar year over the lunar year of
      twelve months, or


      1.2. the age in days of the moon on 1 January of a given year. This
      latter sense is the one used in this routine. This value specifies
      the age of the artificial calendar moon in days at the beginning of
      the calendar year.
   2. This algorithm simply switches the inputs into the proper routine
      for the Julian or Gregorian calendar, based on year. This routine
      may be used to handle situations where either calendar could be used.
   3. This routine returns a value of 0 for invalid years. See the
      individual routines for details.
*/


#include "scdtl_4.h"   /* for epact_gregorian () and epact_julian () */


int epact (int year)
{
   if (year > 1582)
      return (epact_gregorian (year));
   else
      return (epact_julian (year));
}


 
< previous page page_152 next page >