Configurazione del fuso orarioConfigurare il fuso orario

Per impostazione predefinita, le macchine Fedora CoreOS mantengono l’ora nel fuso orario del Tempo Universale Coordinato (UTC) e sincronizzano i loro orologi con il Protocollo di Tempo di Rete (NTP). Questa pagina contiene informazioni su come personalizzare il fuso orario.

Visualizzare e modificare il fuso orario

Il comando timedatectl visualizza e imposta la data, l’ora e il fuso orario.

$ timedatectl status
               Local time: Mon 2021-05-17 20:10:20 UTC
           Universal time: Mon 2021-05-17 20:10:20 UTC
                 RTC time: Mon 2021-05-17 20:10:20
                Time zone: UTC (UTC, +0000)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Puoi utilizzare il sottocomando list-timezones per elencare i fusi orari disponibili. I fusi orari disponibili sono rappresentati dalle voci [tzfile](https://man7.org/linux/man-pages/man5/tzfile.5.html) nel database dei fusi orari del sistema sotto /usr/share/zoneinfo./usr/share/zoneinfo

$ timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
…

See the manual page for more information about how timedatectl can be used; however, we do not recommend changing the time zone per-machine imperatively via SSH.

We recommend that all machines in Fedora CoreOS clusters use the default UTC time zone. It is strongly discouraged to set a non-UTC time zone for reasons including, but not limited to, time zone confusions, complexities of adjusting clocks for daylight savings time depending on regional customs, difficulty in correlating log files across systems, possibility of a stale time zone database, and unpredictability, as local time zones are subject to arbitrary local policies and laws.

If your applications require a different time zone, in most cases, it is possible to set a different time zone than the system one for individual applications by setting the TZ environment variable.

Impostazione del fuso orario tramite Ignition

If you are aware of the downsides to setting a system time zone that is different from the default UTC time zone, you can set a different system time zone by setting the local time zone configuration file, /etc/localtime, to be an absolute or relative symlink to a tzfile entry under /usr/share/zoneinfo/. It is recommended that you set the same time zone across all your machines in the cluster.

For example, you can set the time zone to America/New_York by using a Butane config like the following:

variant: fcos
version: 1.6.0
storage:
  links:
    - path: /etc/localtime
      target: ../usr/share/zoneinfo/America/New_York

Time synchronization

Fedora CoreOS uses the chrony implementation of NTP, with some additional custom logic for specific clouds. For details, see the Fedora CoreOS internals documentation.