OpenELEC/OpenELEC.tv — pull request #2573 by digitaltrousers (2013-09-10 10:34:40+00:00)
Title: Dallas DS1307 realtime clock support

Hi. I'm new to github, and software development in general, so I hope you'll give me some grace.
This change includes a driver for the popular Dallas DS1307 RTC, as used in Raspberry Pi addon boards such as these:
https://www.adafruit.com/products/264
http://www.seeedstudio.com/depot/epoch-realtime-clock-for-raspberry-pi-p-1440.html?cPath=25_30 (this actually uses the DS3231 chip but it's compatible)
The driver should also work for Dallas/Maxim DS1337/38/39/40, ST M41T00, Epson RX-8025.

Once the driver is compiled, a possible way of using it would be adding the following to ~/.config/autostart.sh (for Rev.2 Pi):
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/bus/i2c/devices/i2c-1/new_device # Rev.1 Pi uses i2c-0 instead
hwclock -s

One would first need to set the hardware clock by setting the system clock (or ensuring it is correct already) and doing:
hwclock -w

See http://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time for more info.