You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RTC time not overflowing on tests/periph_rtc on BOARD=bluepill-128kib
Steps to reproduce the issue
Run tests/periph_rtc on BOARD=bluepill-128kib
Expected results
Help: Press s to start test, r to print it is ready
s
START
main(): This is RIOT! (Version: 2021.07-devel-245-g9c749b)
RIOT RTC low-level driver test
This test will display 'Alarm!' every 2 seconds for 4 times
Setting clock to 2020-02-28 23:59:57
Clock value is now 2020-02-28 23:59:57
Setting alarm to 2020-02-28 23:59:59
Alarm is set to 2020-02-28 23:59:59
Alarm cleared at 2020-02-28 23:59:57
No alarm at 2020-02-28 23:59:59
Setting alarm to 2020-02-29 00:00:01
Alarm!
Alarm!
Alarm!
Alarm!
Actual results
As shown, the alarm time doesn't overflow, and counts seconds up to 61.
Help: Press s to start test, r to print it is ready
s
START
main(): This is RIOT! (Version: 2021.07-devel-245-g9c749b)
RIOT RTC low-level driver test
This test will display 'Alarm!' every 2 seconds for 4 times
Setting clock to 2020-02-28 23:59:57
Clock value is now 2020-02-28 23:59:57
Setting alarm to 2020-02-28 23:59:59
Alarm is set to 2020-02-28 23:59:59
Alarm cleared at 2020-02-28 23:59:57
No alarm at 2020-02-28 23:59:59
Setting alarm to 2020-02-28 23:59:61
Alarm!
Alarm!
Alarm!
Alarm!
This is actually not an issue with the driver: The applications asks for an alarm at 2020-02-28 23:59:61 and the drivers generates an alarm at 2020-02-29 00:00:01.
Other implementations of the RTC do normalize the struct tm holding the target time, so that after the call to rtc_timer_set_alarm() the target value is normalized, if it wasn't so before. The RTC driver of the STM32F1 is more a real time counter rather than a real time clock (it uses something similar to UNIX timestamps rather than struct tm). Hence, it doesn't really care if the time is normalized or not.
Other drivers actually need to write the time broken into year, month, day, hour, minute, and second into different registers. They do need a normalized time and will therefore normalize the target time before applying it.
The API doc didn't state anything about normalizing or not normalizing the target time. This of course is an issue, as inconsistent behavior then is surprising. In #19610 the doc is improved so that the behavior here is clearly defined as one of the two valid approaches to denormalized target times.
Description
RTC time not overflowing on
tests/periph_rtc
onBOARD=bluepill-128kib
Steps to reproduce the issue
Run
tests/periph_rtc
onBOARD=bluepill-128kib
Expected results
Actual results
As shown, the alarm time doesn't overflow, and counts seconds up to 61.
Versions
The text was updated successfully, but these errors were encountered: