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);
}
這是日歷計算代碼。請問標紅代碼什么意思,請詳解
|