I'm following this guide to set up the rtc module in Raspbian Stretch.

First question: after the changes described, the RPi doesn't sync anymore with the actual time from the Internet.

Second question: how is handled the sync between system and ds1307 clock? The guide says:

Once the time is set, make sure the coin cell battery is inserted so that the time is saved. You only have to set the time once

In my application an RPi could be powered for months and then suddenly shutdown (removing the power supply, without halting the o.s. which is in read-only). On reboot Internet might not be available and I want to be sure the rtc has the most recent time, not the one set manually or on startup.

1 Answer 1


Just ahead of your reference sentence is:

Plug in Ethernet or WiFi to let the Pi sync the right time from the Internet. Once that's done, run
sudo hwclock -w
to write the time, and another sudo hwclock -r to read the time

Since hardware clocks tend to drift away from real time you should regularly repeat this step if you have an internet connection.

  • Ok, hence kernel doesn't do this by itself. I have to set up a cron job or something else to do manually.
    – Mark
    Aug 22, 2017 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.