Direct access to the hardware calendar (Y/M/D h:m:s.ms).
More...
Direct access to the hardware calendar (Y/M/D h:m:s.ms).
◆ tr_rtc_calendar_get()
Read the current hardware RTC calendar.
- Parameters
-
| [out] | date | Filled with the hardware calendar (Y/M/D h:m:s.ms). |
- Note
- This is a direct read of the hardware time and does not include the wall‑clock offset.
◆ tr_rtc_calendar_set()
Set the hardware RTC calendar safely (preserving uptime).
- Parameters
-
| [in] | date | New hardware calendar value to program. |
- Programs the calendar and waits for the hardware “load” to complete.
- Re‑anchors (base, ref_ms) to the new hardware “now” so the computed uptime remains continuous (no backwards/forwards jump).
- Warning
- Use this when the hardware calendar must change (factory, service, platform policy). For typical application sync without touching HW, prefer tr_rtc_wallclock_ms_set().
- Example
tr_rtc_date_time_t dt = {
.date = { .years = 2025, .months = 5, .days = 1 },
.time = { .hours = 12, .minutes = 0, .seconds = 0, .milliseconds = 0 }
};
void tr_rtc_calendar_set(const tr_hal_rtc_date_time *date)
Set the hardware RTC calendar safely (preserving uptime).