RTC Usage Guide

[中文]

Overview

The real-time clock (RTC) records time in embedded systems and keeps running even in low-power or deep-sleep modes.

Note

The RTC hardware is owned by the CP by default. The AP side only exposes read interfaces.

Usage Scenarios

Common RTC use cases:

  • Measure execution time: record start and end timestamps to compute duration.

  • Obtain NTP time: during AP initialization the task ntp_sync_thread_entry periodically calls ntp_sync_to_rtc to synchronize with the network. After connecting, it stores the offset between wall-clock time and RTC, plus the boot timestamp. If the device goes offline later, call timestamp_get() to obtain the current time.

Further information: RTC example driver

RTC API Reference