On a Linux computer, there are two times, one is the hardware time (the time recorded in the BIOS, called Hwclock), and the other is the operating system time (Osclock). Hardware clock powered by the BIOS battery, when the computer shuts down, will continue to run, the BIOS battery can generally be used for several years, if the power is not available, the BIOS data will be restored to factory settings.
Hardware time
Time is available with time zones, regardless of hardware time or operating system time. The time zone of the Hwclock is set in the/etc/default/rcs file with a parameter of UTC, the default value of true, which means that the UTC time zone is used, and if set to No, the time zone of the osclock is used. It is recommended that the Hwclock be set to the same time zone as Osclock. Note: Because my osclock is also UTC time, so here Utc=yes or Utc=no are the same.
# Assume the BIOS clock is set to UTC time (recommended) Utc=yes
Viewing hardware time
sudo hwclock-r
Write Osclock to Hwclock
sudo hwclock-w
Operating system time
Osclock time zone profile for/etc/timezone, if you want to modify, it is best to use sudo dpkg-reconfigure tzdata to modify the time zone, do not recommend directly modify the/etc/timezone file, if you want to modify the UTC time, When executing the sudo dpkg-reconfigure tzdata command, select none of the ABOVE->UTC to
Cat/etc/timezoneetc/utc
View Osclock
Date
Modify Osclock
#修改时/min/sec sudo date-s hh:mm:ss# modified year/month/day sudo date-s mm/dd/yy
Reference:
Https://www.cnblogs.com/ajianbeyourself/p/4189520.html (the above content is transferred from this article)
Ubuntu 16.04 writes system time to hardware time bios