

				 EASTER, HOLIDAYS, and DATELIB

The Easter, Holidays, and Datelib Programs and Manual Pages are
Copyright (c) 1987 Tigertail Associates. All Rights Reserved.

Author: Robert Uzgalis.

These routine provide date functions similar to ones provided by
most Unix systems.  These however have be augmented by additional
routines to allow one to go to and from Gregorian dates, find
out information about a given Unix date, for example the number
of preceeding calendar weeks to the current date, or the number
of days with the same name in this month.  Also there are a
couple of routines to give information about years, one provides
a Boolean if the year is a leap year, the other provides the Unix
date of 0H for Easter Sunday.

In these routines calculation is only done for the Gregorian calendar.

For these routines a Unix date is assumed to be signed and represent
dates before 1970 -- this is contrary to some advanced speculation.
Using a signed scheme Unix dates cover an era from about 1903 to about
2032.  Beyond these dates other reperesentations must be used.  An
alternative is to consider Unix dates as unsigned longs.  Using that
scheme no date before 1970 can be represented.  These programs use signed
longs but with a beginning era of 1914.  The year 1914 has some nice
properties since it has a calendar identical to 1970 and it falls in the
same place in the leap year cycle.  These programs will fail on dates
between 1903 and 1913.


/* The Date Library Provides the Following Functions: */

long   uxdate(int,int,int);		/* Convert y,m,d to a Unix date at Greenwich*/
long   uxldate(int,int,int);    /* Convert y,m,d to a Unix date locally */
long   uxtime(int,int,int);     /* Convert h,m,s to a Unix time in seconds */
long   uxeaster(int);			/* For y return the Unix date of 0H Easter */
Bool   leap(int);				/* For y return TRUE if a leap year */
int    yrday(int,int,int);		/* For y,m,d return number of preceeding days */
int    weeknum(long);           /* For udate return the week of the month */
int    daynum(long);			/* For udate return the day index of month */

/* The next two routines breakdown a Unix date/time into Gregorian Calendar
 * and time elements.  They perform about the same function as the gmtime
 * system call.  They do not use gmtime however, so they don't destroy its
 * static information.  They retain no static information themself.
 */
void   datex(long,int*,int*,int*,int*,int*);
void   timex(long,int*,int*,int*);

void   ldatex(long,int*,int*,int*,int*,int*); /* Supply localtime breakdown */


To test the datelib routines two test programs were generated.  Easter provides
the date of Easter from the start of the Gregorian Calendar to some
inconcievable date in the future when Christianity will probably not be
practiced.  The other routine is more fun, for a given year it will provide
a list of the holidays for that year including the church dates that depend
on Easter.  It will output in a format compatable with the standard Unix
reminder program calendar(1).  For current years it provides phase of the
moon information.  It can also be made to output a complete calendar for
the year which can be used as a form for calendar(1) reminders.

These routines were developed on a Xenix system on the IBM PC/AT using 
16 bit integers.  They should perform beautifully on a bigger machine.
They have been tried under System Vr2 and Berkeley 4.3.  Although the
Makefile will have to be modified.  The make file is designed to maintain
multiple library models in the Xenix tradition.

Holidays requires the use of getopt(3) which should be availble on your
local system somewhere.  If it is not available locally then a public
domain version is available from a net.sources archive.

To do local time adjustment datelib uses tzset to force the external
timezone and daylight variables to be set.  If these are incorrect the
local time adjustment will be wrong.

INSTALLATION

1. Unpack the shar files.
2. Notice there are two Makefiles
   One is called Makef.bds+sysV
   The other is  Makefile.xenix
   link one or the other to Makefile
   by doing a 'ln xxxxx Makefile'
   where you select xxxxx to be the one
   you want for the kind of system you are
   running on.
3. Edit the Makefile and adjust for local conventions.
   On BSD systems set the TIMEZONE variable.
4. Run make... it should do its thing.
5. Try out Easter and Holidays
6. If you want manual pages run `make man'
   it will produce manual pages you can more
   to your screen in the local directory.
7. 'make install' will install the manual pages
   and the rest of the stuff where you set
   the directorys in the Makefile.
