On Linux systems, there are two kernel options you needs to care about in order to properly manage RTCs from the user space. These are CONFIG_RTC_HCTOSYS and CONFIG_RTC_HCTOSYS_DEVICE.
CONFIG_RTC_HCTOSYS includes the drivers/rtc/hctosys.c code file in the kernel build process, which sets the system time from the RTC on startup and resume. Once this option is enabled, the system time will be set using the value read from the specified RTC device. RTC devices should be specified in CONFIG_RTC_HCTOSYS_DEVICE:
CONFIG_RTC_HCTOSYS=y CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
In the preceding example, we tell the kernel to set the system time from the RTC, and we specify that the RTC to use is rtc0.