home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 1
/
FishNMoreVol1.bin
/
more
/
code_examples
/
librar
/
jule2dat.c
< prev
next >
Wrap
Text File
|
1989-02-08
|
1KB
|
48 lines
/*--------------------------------------*/
/* */
/* JULE2DATE(X,X,X) */
/* */
/* Fills the second argument with a date*/
/* when given the julian day in the */
/* first argument. The third argument */
/* is the year. */
/* */
/*--------------------------------------*/
void jule2date(a,b,year)
int a,year;
char b[8];
{
int j,month,day,MN[12];
MN[0]=31;
MN[1]=28;
MN[2]=31;
MN[3]=30;
MN[4]=31;
MN[5]=30;
MN[6]=31;
MN[7]=31;
MN[8]=30;
MN[9]=31;
MN[10]=30;
MN[11]=31;
if (!efactor(year,4))
++MN[1];
month=day=0;
for (j=0;j<12;j++){
if (a<=MN[j]){
month=j+1;
day=a;
j=12;
}
else
a-=MN[j];
}
b[6]=(year/10)+48;
b[7]=year-(10*(b[6]-48))+48;
b[0]=(month/10)+48;
b[1]=month-(10*(b[0]-48))+48;
b[3]=(day/10)+48;
b[4]=day-((b[3]-48)*10)+48;
b[2]=b[5]=47;
}