Linux Tuning system time zone:
Locate the appropriate time zone file/usr/share/zoneinfo/asia/shanghai
Replace the current/etc/localtime file with this file
It's time for a date to be CST.
If not, change the value of the TZ environment variable.
Many programs and commands will use the value of this variable, TZ value can have a variety of formats, the simplest way to set up is to use the Tzselect command or terminal input tz= ' CST-8 '; The export TZ is available.
However, this change only in the entry into force, if you want to permanently take effect, it is necessary to put tz= ' CST-8 '; Export TZ adds these two sentences to your. Profile.
In Linux determine the system time zone first look at the TZ environment variable, if the TZ environment variable is not set, and then read the/etc/localtime file to determine your time zone
This file controls how the hardware clocks (hardware clock) are interpreted.
The system reads the contents of the/etc/sysconfig/clock file at startup and invokes the Hwclock command to set the system clock based on the content.
The following is an explanation of the file configuration items that are forwarded:
Set the file/etc/sysconfig control how the time is interpreted by the hardware clock (hardware clocks).
Utc=true|yes|false|no-Specifies whether the time of the hardware clock is Greenway time or system local time. True or yes indicates that the hardware clock is using Greenway, while the other is local time. Preset to local time.
Arc=false|no-Specifies whether the hardware clock 1980 epoch time (typically the epoch time used by an Alpha computer using the ARC console). False or no indicates the normal UNIX epoch Time-1970. Preset use of normal UNIX epoch time
Srm=false|no-Specifies whether the hardware clock 1900 epoch time (typically using the epoch time for the Alpha computer using the SRC console). False or no indicates the normal UNIX epoch Time-1970. Preset use of normal UNIX epoch time
Zone= time Zone-the current system local time zone name, just let the time Date property tool System-config-data know the current time zone referred to by/etc/localtime, changing its value does not change the actual system time zone. The value must be the time zone file name under/usr/share/zoneinfo.
Here is a configuration for this file:
If your original set of hardware clock time is GMT to remember to change this command, remember to use 4) method to write the system time to the hardware clock, otherwise, the next boot system will be the hardware clock recorded by the GMT as the current time of Asia/shanghai.
3) Adjust the system time method
The order of the time set to August 30, 2005 is as follows:
The command to set the system time to 6:40 P.M. 0 seconds is as follows.
The time set here is only set the system time, after the next reboot of the system will still read the original time from the hardware clock, so in order to make the time setting takes effect will use 4) command
If you want to synchronize with the standard time, you should use Ntpdate, and the NTP server to do a time synchronization. Similarly, the method of synchronizing the system time using 4 is also written to the hardware clock.
4) Write system time to hardware clock Comos
You can use the clock or Hwlock command, or you can set the time of the hardware clock in the BIOS.
About Linux system clocks and hardware clocks:
The Linux system has two clocks, one is the system clock, the other is the hardware clock (COMOS), the hardware clock is the clock on the motherboard through the crystal oscillator, usually powered by a battery, generally can be used for about three years.
When the Linux system starts, it reads the hardware clock, sets the time of the hardware clock to the current system time, and then the system time runs independently of the hardware clock. The system clock is maintained by the Linux kernel, and the hardware clock is controlled by the crystal oscillator.
Time zone and time adjustment for Linux systems