SSP v1.2.0 added a validation of the rtc_time_t.tm_mon parameter when calling the RTC driver calendarTimeSet() function. It checks that the p_time.tm_mon parameter is >= 0 and <= 11. Is this actually correct. I thought the tm_mon parameter should be 1 for January and 12 for December and this is how I have been using it with SSP v1.1.3 (which did not validate the parameters) and the RTC has been working fine.
I ran a test and set the date to tm_mon=1, tm_mday=28, and tm_year=117. I let the RTC clock run so that it eventually changes to the following day and when it does it returns tm_mon=1, tm_mday=29, and tm_year=117. If tm_mon starts at 0 then this is returning a date of Feb 29, 2017 which is invalid.
I then ran another test and set the date to tm_mon=2, tm_mday=28, and tm_year=117. I let the RTC clock run so that it eventually changes to the following day and when it does it returns tm_mon=3, tm_mday=1, and tm_year=117.
So it appears the tm_mon should be 1 for January and 12 for December instead of 0 for January and 11 for December.
In reply to jbishop:
In reply to garyj:
Hey Gary! Thanks for letting us know it's being worked on. In the interim, is there a good workaround for Jeff? -Josh RenesasRulz Forum Moderator
And what about the year? It seems that there is also some problem. Making your corrections to r_rtc.c to solve the months issue, setting tm_year = 117 and letting it run in the demo project RTC_HAL_MG_AP I get Get_time: 31-12-2017 23:59:57 Get_time: 31-12-2017 23:59:57 Get_time: 31-12-2017 23:59:58 Get_time: 31-12-2017 23:59:58 Get_time: 31-12-2017 23:59:59 Get_time: 31-12-2017 23:59:59 Get_time: 1-1-1900 0:00:00 Get_time: 1-1-1900 0:00:00 Get_time: 1-1-1900 0:00:01 Get_time: 1-1-1900 0:00:01 Get_time: 1-1-1900 0:00:02
(note: I'm adding 1900 to the year prior to printf() because the C standard says tm_year is years since 1900) Regards
In reply to Laboratori Elecsan:
In fact, any year higher than tm_year = 99 goes to 0 after december 31. Should we use <time.h> as if the offset was 2000 instead of 1900 like the Synergy peripheral?
In reply to Renesas Karol:
In reply to JeffP:
In reply to Jimmy:
In reply to isaenz: