The method used is different under raspbian jessie to that used with wheezy
I was lucky enough to stumble across http://afterthoughtsoftware.com/products/rasclock early in my searches and it provided me with the final clues I needed.
Your RTC module may have come with instructions, if so read them but bear in mind it is possible they were written for installation under wheezy as jessie is quite new to the official raspbian release.
NB. Where you need to alter files it is always a good idea to save the original as a backup with a command similar to this
Code: Select all
sudo cp /etc/default/hwclock /etc/default/hwclock.BAK
At the end of this step, instead of rebooting now select later.
Now take a look at /boot/overlays/README, scroll to the i2c-rtc section, find your RTC and make a note of the parameter required.
Code: Select all
less /boot/overlays/README
My RTC is a ds1307 so its parameter is ds1307 so I need to add dtoverlay=i2c-rtc,ds1307 to config.txt, yours will likely require a different parameter but the syntax is the same (see https://www.raspberrypi.org/documentati ... fig-txt.md if you are not sure how to edit this file).
Once edited, save the file and exit your editor.
See https://www.raspberrypi.org/documentati ... ce-tree.md for dtoverlays docs.
To make sure relevant modules are loaded at boot time we will now look at /etc/modules. I suggest doing this with
Code: Select all
sudo nano /etc/modules
i2c-dev, i2c-bcm2708 and the relevant module for your RTC, the module for mine is rtc-ds1307 so I add rtc-ds1307 yours may be different, add it on a new line and make sure you have an empty line at the end of your new added lines. (nano keys are at the bottom of the editor, Crtl-x to exit, y to save.)
Now reboot. Hopefully all will come back with no nasty messages.
Install i2c-tools
Code: Select all
sudo apt-get install i2c-tools
Code: Select all
sudo dpkg --purge fake-hwclock
Note that I have struck out the above line as it seems that if fake-hwclock is removed then 1 Jan 1970 timestamps will appear in /var/logs/syslog early in the boot sequence - try it and see

Now we'll check that the RTC is available with
Code: Select all
sudo i2cdetect -y 1
Code: Select all
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
We can now edit /lib/udev/hwclock-set with
Code: Select all
sudo nano /lib/udev/hwclock-set
Code: Select all
if [ -e /run/systemd/system ] ; then
exit 0
fi
Code: Select all
#if [ -e /run/systemd/system ] ; then
# exit 0
#fi
The first mentioned link also suggests that you comment out the closely following two lines containing --systz
There is a link to a bug-list thread to justify this https://bugs.debian.org/cgi-bin/bugrepo ... bug=764552 , however, if you scroll almost to the bottom of that same page it seems that these two lines are required - particularly if you are running ntp as I do.
My RTC is running fine with them in, others have theirs running fine with them commented out. Take your pick and see if all is working as it should

Now
Code: Select all
date
Code: Select all
sudo hwclock -w
Code: Select all
sudo hwclock -r
Code: Select all
sudo hwclock -s
You may edit/etc/default/hwclock however the defaults here should just work.
Reboot and check /var/log/syslog.
If all is working as it should you will now see correct timestamps after the system restarts.