home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
addjule.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
1KB
|
43 lines
/*--------------------------------------*/
/* */
/* ADDJULE(X,X,X) */
/* */
/* Functionality: */
/* Adds julian days to a date and */
/* creates the new date. */
/* Arguments: */
/* 0: The date to be added to. */
/* This is in the form MM/DD/YY.*/
/* 1: The number of days to add. */
/* 2: The resulting date. */
/* Functions used: */
/* EFACTOR(),GETJULE(),JULE2DATE() */
/* Returns: Nothing */
/* Author: John Callicotte */
/* Date created/modified: 09/01/88 */
/*--------------------------------------*/
void addjule(a,b,c)
int b;
char a[8],c[8];
{
int maxx,jules,year;
year=(a[6]-48)*10+a[7]-48; /* Get first date's year */
jules=getjule(a)+b; /* Figure new julian days */
A1: maxx=365;
if (!efactor(year,4)) /* Is this leap year? */
maxx++; /* Yes, 366 days/year */
if (jules<=maxx) /* Are the number of julian days */
goto A2; /* less than the days/year? */
jules-=maxx; /* Subtract from the total the */
/* number of days/year. */
++year; /* Increment the year */
goto A1;
A2: jule2date(jules,c,year); /* Create the new date */
}