
V4.0
Element14 | element14.com/PiDesktop
20
Step4: Sync time from Pi to RTC
Setting the correct time is simple. First, run the date to verify the time is correct.
Connect the Raspberry Pi to the internet via an Ethernet or WiFi to allow the
Raspberry Pi to initially sync the correct time from the Internet. Once this has
been done, run:
sudo hwclock -w
to write the time, followed by:
sudo hwclock -r
to read the time
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. The next time you boot the Raspberry
Pi, the time will automatically be synced from the RTC module.
Step5: Update the RTC date during reboot and poweroff
A systemd service is required in order to update the RTC date during a reboot or
power off. This will cause systemd to execute a script called sync-hwclock to