< previous page page_99 next page >

Page 99
Listing 5.11 year_type()
/* yeartype.c
   +-------------------------------------------+
   |   Copyright (C) 1995 by Lance W. Latham.  |
   |         All rights reserved.              |
   +-------------------------------------------+
   This routine returns the 'year type' of the given year. Year type
   is defined according to the 14 types of year possible in the
   'Western' perpetual calendar.


   INPUTS:
   1. year, type int, the year for which the year type is desired.
      This routine accepts dates in the range of a 'signed int', or
      -32767 to 32767. Thus, it handles both Julian and Gregorian dates.
      Input is assumed to be a year in the Western calendar. Year 'B.C.'
      are input in the astronomical format, using negative numbers.
   OUTPUTS:
   1. Return by routine, type int, the year type for the input year.
      Valid return values are 1 through 14. See notes below for the
      meanings of each value.
   NOTES:
   1. The classification system for these 14 types assigns a type number
   to a year, as follows:


   Year Type   Year starts on DOW       Year is a leap year
   ---------   ------------------       -------------------
       1            Sunday                    No
       2            Monday                    No
       3            Tuesday                   No
       4            Wednesday                 No
       5            Thursday                  No
       6            Friday                    No
       7            Saturday                  No
       8            Sunday                    Yes
       9            Monday                    Yes
      10            Tuesday                   Yes
      11            Wednesday                 Yes
      12            Thursday                  Yes
      13            Friday                    Yes
      14            Saturday                  Yes


   This usage is common and general, it not completely standard.
   Many almanacs use it, and it is logically consistent with the
   order of the DOW (Sunday through Saturday).


   2. The 'day of the week' routines in this system return values
   consistent with this assignment. The DOW index has a range of 0

 
< previous page page_99 next page >