Sysfs Interface

The sysfs interface can be used to read and set the status of RTC.

The interface only supports setting on the following two parameters:
  • wakealarm: Run the following command to set a wakeup alarm in X seconds since the current RTC time.
    echo ‘+X’ > /sys/class/rtc/rtc0/wakealarm 
    Note: The interface is Linux original and the alarm is set in seconds. For example, to set an alarm which rings after 2 hours, use the following command:
    echo ‘+7200’ > /sys/class/rtc/rtc0/wakealarm 
  • offset: Used to calibrate the time offset caused by temperature and oscillator. Not recommended to use in the current product release.
The following code block shows a simple example.
# cd /sys/class/rtc/rtcO/ 
# ls 
alarmtimer.0.auto        hctosys            range            uevent
date                     max_user_freq      since_epoch      wakealarm
dev                      name               subsystem
device                   offset             time
# cat date 
2001-02-01 
# cat time 
00:23:57