u8 const table_week[12]={0,3,3,6,1,4,6,2,5,0,3,5}; //月修正数据表
char SRTC_Get_Week(u16 year,u8 month,u8 day) //计算星期几
{
u16 temp2;
u8 yearH,yearL;
yearH=year/100; yearL=year%100;
if (yearH>19)yearL+=100;
temp2=yearL+yearL/4;
temp2=temp2%7;
temp2=temp2+day+table_week[month-1];
if (yearL%4==0&&month<3)temp2--;
if(temp2%7==0) return 7;
return(temp2%7);
}
这是日历计算代码。请问标红代码什么意思,请详解
|