Computers for industrial control and automation systems

RTC RB100

RTC

Pigeon RB100 has a real-time clock with a backup battery (CR2032). When the system starts, it takes the time from the RTC if system clock update is failed through NTP.

Useful commands

  • Read hardware clock date and time

    hwclock
  • Copy system time to hardware time

    hwclock -w
  • Copy hardware time to system time

    hwclock -s
  • Set hardware clock date and time manually
    hwclock --set --date "02/20/2016 11:10:00"

Change system time zone

  • Run:
    raspi-config
  • Select Internationalization options
  • Select Time Zone
  • Select Geographical area
  • Select city or region

Network time synchronization

There's a systemd-timesync service running on a default install of Stretch. Systemd-timesyncd is a daemon that has been added for synchronizing the system clock across the network. It implements an SNTP client. Make sure the machine is allowed to query servers over port 123/udp.

To check the service status, use:

timedatectl

You can also watch systemd/clock:

pi@pigeon:~$ stat /var/lib/systemd/clock
  File: /var/lib/systemd/clock
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: b302h/45826d    Inode: 18931       Links: 1
Access: (0644/-rw-r--r--)  Uid: (  100/systemd-timesync)   Gid: (  103/systemd-timesync)
Access: 2019-01-11 11:40:58.613881976 +0000
Modify: 2019-01-11 11:40:58.613881976 +0000
Change: 2019-01-11 11:40:58.613881976 +0000
 Birth: -

The Access/Modify/Change times on this file show when systemd-timesynd last touched it.

Restarting the systemd-timesyncd service force a sync:

systemctl restart systemd-timesyncd

Systemd-timesyncd automatically updates the hardware clock after sync.

If you would like to change NTP servers (for example to a local one) edit file /etc/systemd/timesyncd.conf. The configuration parameters PollIntervalMinSec and PollIntervalMaxSec that can be set in /etc/systemd/timesyncd.conf are not recognized in current Raspbian. Default PollIntervalMaxSec is 2048 seconds.

Network time synchronization is enabled by default. To disable it use:

timedatectl set-ntp false
Back to Top