pleriche
Posts: 85
Joined: Mon Oct 14, 2013 8:44 am

real/fake hwclock/ntp interaction

Sun Dec 09, 2018 10:15 am

From what I've read it seems you have to uninstall fake-hwclock if you've got a real one (e.g. DS1307).

But I want my Pi to do the best it can given that it may or may not have the DS1307 plugged in today which may or may not have been initialised, and it may or may not have a network connection. In this era of plug'n'play that doesn't sound an unreasonable thing to ask, but as far as I can see it doesn't seem to be supported out-of-the-box. Can someone help me please, or at least point me to the scripts I'll have to hack and how to tell whether the hwclock kernel module has found some hardware to tickle.

(My Pi is currently still running Wheezy but I'll upgrade when I've sorted out one or two unrelated problems.)

gordon77
Posts: 3746
Joined: Sun Aug 05, 2012 3:12 pm

Re: real/fake hwclock/ntp interaction

Sun Dec 09, 2018 11:05 am

Here's what I did with my ds1307, l found it on this forum somewhere.

add dtoverlay=i2c-rtc,ds1307 to /boot/config.txt

in /lib/udev/hwclock-set put # in front of these lines
if [-e /run/systemd/system ]; then
exit
fi

and # in front of the 2 lines containing --systz

reboot your pi

set the clock with sudo date -s "08 Dec 2018 10:12:00" using the correct date and time
sudo hwclock -w
sudo hwclock -r

Return to “Advanced users”