的公历日
temp3=temp2-1; //计算当年春节离当年元旦的天数,春节只会在公 历1 月或2 月
if(temp1!=1)temp3+=0x1f;
if(month<10){temp4=day_code1[month-1]+day;} else{temp4=day_code2[month-10]+day;}
if((month<2)||(year%0x04!=0))temp4-=1; //如果公历月小于2 月或者该
年的2 月非闰月,天数减1
if (temp4>=temp3) //判断公历日在春节前还是春节后 {
//公历日在春节后或就是春节当日使用下面代码进行运算 temp4 -=temp3; month = 1; flag_y = 0;
month_p= 1; //month_p 为月份指向,公历日在春节前或就是春节当
日month_p 指向首月
flag2=get_moon_day(month_p,code_addr); //检查该农历月为大
小还是小月,大月返回1,小月返回0
if(flag2==0){temp1=29;}else{temp1=30;} //小月29 天、大月30 天
temp2=year_code[code_addr]&0xf0;
temp2=_cror_(temp2,4); //从数据表中取该年的闰月月份,如为0 则 该年无闰月
while(temp4>=temp1) {
temp4-=temp1; month_p+=1; if(month==temp2) {
flag_y=~flag_y; if(flag_y==0)month+=1; }
else month+=1;
flag2=get_moon_day(month_p,code_addr); if(flag2==0)temp1=0x1d; else temp1=0x1e; }
day=temp4+1; }
else {
//公历日在春节前使用下面代码进行运算 temp3-=temp4;
if(year==0){year=0xe3;}else{year-=1;} code_addr-=3; month = 0xc;
temp2 = year_code[code_addr]&0xf0; temp2 = _cror_(temp2,4); flag_y = 0;
if(temp2==0){month_p=12;}else{month_p=13;} //年有闰月,
一年有十三个月,月指向13,无闰月指向12 flag2=get_moon_day(month_p,code_addr); if(flag2==0){temp1=29;}else{temp1=30;} while(temp3>temp1) {
temp3-=temp1; month_p-=1;
if(flag_y==0)month-=1;
if(month==temp2)flag_y=~flag_y; flag2=get_moon_day(month_p,code_addr);
如果当if(flag2==0){temp1=0x1d;}else{temp1=0x1e;} }
day=temp1-temp3+1; }
Tim[7] = year|(Tim[0]&0x80);; //将农历信息写进指定变量
Tim[8] = month; Tim[9] = day;
Conver_week(); //最后进行星期转换(根据需要自行选用) } 此
主
题
相
关
图
片
如
下
: