1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Revert "cpu/sam0_common: RTC: avoid negative month after POR"

This reverts commit 897a3ceda9.
This commit is contained in:
Benjamin Valentin 2024-03-07 12:55:23 +01:00
parent 8c4d0c53f2
commit 6389b3c83b

View File

@ -566,18 +566,12 @@ int rtc_get_alarm(struct tm *time)
return -1;
}
time->tm_mon = alarm.bit.MONTH;
time->tm_mon = alarm.bit.MONTH - 1;
time->tm_mday = alarm.bit.DAY;
time->tm_hour = alarm.bit.HOUR;
time->tm_min = alarm.bit.MINUTE;
time->tm_sec = alarm.bit.SECOND;
/* struct tm has January as 0, RTC has January as 1 */
/* But after power-on reset, all RTC values are 0 - avoid negative month */
if (time->tm_mon) {
--time->tm_mon;
}
return 0;
}
@ -596,18 +590,11 @@ int rtc_get_time(struct tm *time)
return -1;
}
time->tm_mon = clock.bit.MONTH;
time->tm_mon = clock.bit.MONTH - 1;
time->tm_mday = clock.bit.DAY;
time->tm_hour = clock.bit.HOUR;
time->tm_min = clock.bit.MINUTE;
time->tm_sec = clock.bit.SECOND;
/* struct tm has January as 0, RTC has January as 1 */
/* But after power-on reset, all RTC values are 0 - avoid negative month */
if (time->tm_mon) {
--time->tm_mon;
}
return 0;
}