Hello,
I found that WeekDay parameter of adl_rtcTime type gets between values 0-6. What is more, Sunday is not 6, it is 0. Parameter flows between Sunday-Saturday not Monday-Sunday. Look at the following:
WeekDay=0: Sunday
WeekDay=1: Monday
WeekDay=2: Tue
WeekDay=3: Wed
WeekDay=4: Thu
WeekDay=5: Fri
WeekDay=6: Sat
That makes some confusion. I write a piece of code to show that. The code is following:
char strMessage[100]={0};
adl_rtcTime_t rtcNow;
int i=7;
adl_rtcGetTime(&rtcNow);
AddHour(&rtcNow, 1); // just init the WeekDay param for the first use
while(i != 0)
{
wm_sprintf(strMessage, "Rtc Date:%d/%d/%d,%d:%d:%d Weekday:%d\r\n", rtcNow.Year, rtcNow.Month, rtcNow.Day, rtcNow.Hour, rtcNow.Minute, rtcNow.Second, rtcNow.WeekDay);
adl_atSendResponse(ADL_AT_RSP, strMessage);
AddHour(&rtcNow, -24); // adds -24 hours
i--;
}
And this code outputs the following lines. You can check from your calender.
Rtc Date:2011/10/5,11:5:58 Weekday:3 // Wed
Rtc Date:2011/10/4,11:5:58 Weekday:2 // Tue
Rtc Date:2011/10/3,11:5:58 Weekday:1 // Monday
Rtc Date:2011/10/2,11:5:58 Weekday:0 // Sunday
Rtc Date:2011/10/1,11:5:58 Weekday:6 // Saturday
Rtc Date:2011/9/30,11:5:58 Weekday:5 // Fri
Rtc Date:2011/9/29,11:5:58 Weekday:4 // Thu
What is more, the both documantation “ADL User Guide for Open AT® OS 6.35” and “ADL User Guide for Open AT® OS 6.32” tells that WeekDay is between 1-7. I now see this information is wrong.
If you want to use WeekDay field for some calculations, you need to be careful.
I tested my code on R7.43 and R7.45.