This topic describes the concepts relating to time and time zones in Linux operating systems. It also describes how to manage them and the differences in clock configurations in some Alibaba Cloud Linux public images.

Background information

The following table describes the basic concepts related to time and time zones in Linux operating systems.
ConceptDescription
clockLinux has the following clocks:
  • Hardware clock: This clock is also known as the real-time clock (RTC). It refers to the battery-powered clock located on the physical machine. This time can be configured through the Linux BIOS.
  • System clock: the clock maintained by the Linux kernel. When Linux boots, it sets the system time based on the configurations in the /etc/adjtime file. Linux reads the hardware clock and uses it to set the system clock. After that, the system clock runs independently of the hardware clock. The Linux kernel keeps track of the system clock by counting timer interrupts.
time standardLinux has two time standards:
  • localtime: the time standard based on the local time zone where the operating system resides.
  • Coordinated Universal Time (UTC): the global time standard and is independent of time zones.

Managing time and time zones

  • Run the following command on a Linux machine to view the time settings:
    timedatectl status
    Information about the time settings of the machine is returned (see the following figure). This information includes the local time, UTC time, RTC time, and time zone of the Linux operating system. View time settings
  • Run the timedatectl command to set the time standard of the hardware clock.
    • Set the time standard of the hardware clock to localtime:
      timedatectl set-local-rtc 1
      Validation: If you run the timedatectl status command and the value of RTC in local TZ is yes, the time standard of the hardware clock is localtime.
    • Set the time standard of the hardware clock to UTC:
      timedatectl set-local-rtc 0
      Validation: If you run the timedatectl status command and the value of RTC in local TZ is no, the time standard of the hardware clock is UTC.
Note The /etc/adjtime file stores the configurations for setting the system clock. When you run the preceding commands, the configurations in the /etc/adjtime file is automatically updated.

Public images in which the Alibaba Cloud RTC uses the UTC time standard

By default, RTC in Alibaba Cloud public images uses the localtime time standard. Note that Alibaba Cloud has changed the default localtime time standard used by RTC to the UTC time standard. In the following public images and their later versions, RTC uses the UTC time standard. For more information about the release of public images whose RTC use the UTC time standard, see the following topics.