How do you set the time?

Hey Dale, hey Thomas @Thomasaburt, hey Scott @ssamborn, hey all,

to adjust timezone, time and date, either you open a terminal window (on the Onefinity Controller, hold down “Ctrl” and then click “T” and then “C” (type “exit” to exit again)) or you log in with a ssh (user: bbmc, password: onefinity), and then do:

sudo -i
raspi-config

Then you can choose “Localisation Options – Set up language and regional settings to match your location” > “Change Timezone – Set up timezone to match your location”

Screenshot_2023-03-08_03-52-04__Onefinity_Controller_Timezone

You may also use   tzselect   instead of   raspi-config  .

If the time itself is wrong, you can set it with   date --set=STRING   . The command   man date   shows details on what to insert in place of “STRING”:

DATE STRING

The --date=STRING is a mostly free format human readable date string such as “Sun, 29 Feb 2004 16:21:42 -0800” or “2004-02-29 16:21:42” or even “next Thursday”. A date string may contain items indicating calendar date, time of day, time zone, day of week, relative time, relative date, and numbers. An empty string indicates the beginning of the day. The date string format is more complex than is easily documented here but is fully described in the info documentation.

( …which means the command   info date   )

Example

date --set="Mar 8 04:10"

Note that the Raspberry Pi has no real-time clock onboard. The Onefinity Controller uses fake-hwclock which means the clock will always be relatively inaccurate as long your Onefinity Controller has no access to the internet. If it has, the clock is synchronized through systemd-timesyncd.service. The most precise way to have time and date on your computer, besides to attaching a long-wave radio clock module (as shown here) that usually receives its signal from an atomic clock, is to install NTP support with the ‘ntp’ package (available as normal package from the Raspi OS repository). (See also Network Time Foundation’s NTP Support Wiki)

You can at any time check the time status on the Onefinity Controller with the command timedatectl:

bbmc@onefinity:~ $ timedatectl status
      Local time: Wed 2023-03-08 05:18:01 CET
  Universal time: Wed 2023-03-08 04:18:01 UTC
        RTC time: n/a
       Time zone: Europe/Berlin (CET, +0100)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

On this output of timedatectl, you can see that

  1. a real-time clock is not available,
  2. systemd-timesyncd.service is on but
  3. it could not connect to a NTP server in the internet.

Without access to the internet, the clock cannot be synchronized, and fake-hwclock manages the time and date.

Further reading

3 Likes