1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/periph_rtc
Benjamin Valentin b1724a7d1b periph/rtc: normalize struct tm before usage
A naive implementation may set a RTC alarm in 30s by calling

	struct tm now;
	rtc_get_time(&now);
	now.tm_sec += 30;
	rtc_set_alarm(&now, _cb, NULL);

This works for RTC implementations that use a RTT internally and call
mktime() to convert the struct tm to a unix timestamp, as mktime() will
normalize the struct in the process.

Call rtc_tm_normalize() when the RTC uses separate registers for time / date
components to ensure it is normalized.

This also modifies tests/periph_rtc to exercise this case.
2019-09-12 11:32:31 +02:00
..
tests tests/periph_rtc: add automatic python test script 2019-01-18 14:42:58 +01:00
main.c periph/rtc: normalize struct tm before usage 2019-09-12 11:32:31 +02:00
Makefile tests: remove redundant APPLICATION defines 2017-12-01 11:03:39 +01:00
README.md tests/periph_rtc: fix alarm period in README 2019-01-18 09:17:30 +01:00

Expected result

When everything works as expected, after start-up, 4 alarm messages are displayed every 2 seconds.

Background

Test for the low-level RTC driver.