Skip to main content

<alp/rtc.h> — Real-Time Clock

Wall-clock time + multi-source alarms.

#include <alp/rtc.h>

Set and read

alp_rtc_t *rtc = alp_rtc_open(NULL);

alp_rtc_time_t now = {
.year = 2026, .month = 5, .day = 13,
.hour = 22, .minute = 28, .second = 0,
};
alp_rtc_set(rtc, &now);

alp_rtc_read(rtc, &now);
printk("%04u-%02u-%02u %02u:%02u:%02u\n",
now.year, now.month, now.day, now.hour, now.minute, now.second);

Alarms

void on_alarm(alp_rtc_t *r, void *user) { /* ... */ }

alp_rtc_time_t fire_at = { /* future timestamp */ };
alp_rtc_set_alarm(rtc, 0, &fire_at, on_alarm, NULL);

On-module RTC chip

Every Alp Lab SoM populates a Micro Crystal RV-3028-C7 as the persistent RTC (battery-backed, low-leakage). On Yocto the SDK binds this device to the standard Linux RTC subsystem; on Zephyr it is exposed via <alp/chips/rv3028c7.h> and <alp/rtc.h> transparently uses it as the backing store.

See also

Questions about this page? Discuss in Community Forum