# HG changeset patch # User Paul Boddie # Date 1715706899 -7200 # Node ID 6801170ae90dbc3a8a2b72b2043c4c16d526ca4f # Parent 135649724e29583bcdfe0b6d61c06aea34c01e9e Employ a value in seconds to set the RTC alarm without trying to calculate a value based on some other level of accuracy. diff -r 135649724e29 -r 6801170ae90d pkg/landfall-examples/hw_info/hw_info.c --- a/pkg/landfall-examples/hw_info/hw_info.c Sat May 04 22:53:28 2024 +0200 +++ b/pkg/landfall-examples/hw_info/hw_info.c Tue May 14 19:14:59 2024 +0200 @@ -1369,19 +1369,17 @@ printf("RTC frequency: %lld\n", cpm_get_frequency(cpm, clock)); } -static void rtc_reset(void *rtc, void *cpm) +static void rtc_reset(void *rtc) { unsigned int seconds; if (!read_number("Seconds", &seconds)) return; - enum Clock_identifiers clock = rtc_get_clock(rtc); uint32_t rtc_seconds = rtc_get_seconds(rtc); - uint32_t value = seconds * cpm_get_frequency(cpm, clock); rtc_alarm_disable(rtc); - rtc_set_alarm_seconds(rtc, rtc_seconds + value); + rtc_set_alarm_seconds(rtc, rtc_seconds + seconds); rtc_hibernate(rtc); } @@ -1928,7 +1926,7 @@ else if (!strcmp(token, "p") || !strcmp(token, "power-down")) rtc_power_down(rtc); else if (!strcmp(token, "r") || !strcmp(token, "reset")) - rtc_reset(rtc, cpm); + rtc_reset(rtc); else if (!strcmp(token, "s") || !strcmp(token, "set")) _rtc_set_seconds(rtc, 0); else if (!strcmp(token, "sa") || !strcmp(token, "set-alarm"))