Working with RTC in Linux

Reading information from the RTC


  • On a new controller the time and date information may not yet be stored in the RTC chip. Therefore an error message will be displayed when you try to read data from it.

  • To eliminate this error you need to write date and time information to the RTC chip.

Reading is done by the following command:

hwclock -r

Example conclusion:



Example conclusion:

               Local time: Вт 2020-09-01 15:35:48 MSK
           Universal time: Вт 2020-09-01 12:35:48 UTC
                 RTC time: Вт 2020-09-01 12:35:49
                Time zone: Europe/Moscow (MSK, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Writing information to the RTC


The system time must be set correctly beforehand.


The controller with Armbian Linux is configured to synchronize time over the Internet using the NTP protocol. If the controller has access to the Internet and has the correct time zone set, you do not need to configure anything.

Recording is done by the following command:

hwclock --systohc