Hi everyone,
There have been some questions in these forums about RTC support in LE, and there's various info on the web, some of which is confusing because it applies to Raspbian or to older versions of OE, so I thought it might not be a bad idea if I simply documented my procedure for installing a Real Time Clock in my Raspberry Pi with LibreElec 8. This worked for me, right off the bat.
[Update, September 2024: This still applies to later LE versions, including LE12. Tested and found to be working on the RPi3 and RPi4. Note that the RPi5 has a RTC built in and that LE has support for same.]
These instructions are for the DS3231 RTC modules that can be ordered for next to nothing from a variety of sources.
1. Unplug your Pi and Install the RTC module onto the GPIO connector pins 1-4 as follows:
2. Switch your RPi back on and SSH into it.
3. Enable kernel support:
3a. Remount LE system partition r/w: mount -o remount,rw /flash
3b. Edit /flash/config.txt and add (somewhere near the end): dtoverlay=i2c-rtc,ds3231
3c. Remount LE system partition r/o: mount -o remount,ro /flash
3d. Reboot.
4. Adjust the RTC's time:
4a. Verify local system time with the 'date' command. If local time is off, either adjust it manually or connect your Pi to the Internet and wait for it to the the correct time from an NNTP server.
4b. Transfer local time to RTC: hwclock -w
4c. Verify RTC time: hwclock -r
That's it. You're done. Your LibreElec RPi will now have the correct time every time it powers up. Don't worry about loading kernel modules, disabling fake clocks or other configuration changes. In LE8 you don't need them; whatever instructions you may have found referring to that sort of thing applies to other operating systems or older versions.
Note: edits to /flash/config.txt should survive LE upgrades; edits to /flash/distroconfig.txt won't. Should you end up having to reinstall LE, don't forget to restore your edits to /flash/config.txt.