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). The hardware clock is powered by the BIOS battery. When the computer is turned off, it will continue to run. The BIOS battery can generally be used for several years. If it is out of power, the data in the BIOS will be restored to the factory settings. Interaction process between hardware time and operating system time 1. When booting, the operating system reads the hardware time + time zone from the BIOS, and then converts it to the corresponding time according to the time zone of osclock. Then the operating system time and hardware time run independently and do not affect each other. The time obtained by the application uses the operating system time. This step is completed automatically by the OS when the computer is turned on. 2. During the operation of the host, ntp is used to ensure that osclock is synchronized with the international atomic time, and then osclock is synchronized to hwclock. This step requires your own configuration 3. When shutting down, osclock is written to hwclock. This step is automatically completed by the OS when shutting down. However, we need to consider the abnormal shutdown situation. When the shutdown is abnormal, osclock may not be written into hwclock. This is why This is why osclock is periodically flashed into hwclock in step 2. If you don't flash regularly, when the difference between osclock and hwclock is large, if you shut down abnormally, osclock will be lost, and when you restart, osclock will be Wrong, osclock has been wrong since the first ntp synchronization. And if you use ntpd, ntpd is a gradual adjustment, it will take several ntp synchronization cycles before the osclock is adjusted to the international atomic In addition, if the time difference between osclock and ntp server exceeds 1000 seconds, the ntp server will not update osclock. How to modify the time zone and time in Ubuntu 1. First check the time zone: codetc@webubuntu:~$ date -R Tue, 17 Dec 2013 18:23:01 +0800 If you want to change the time zone, execute 2. Select region: Asia codetc@webubuntu:~$ sudo tzselect [sudo] password for codetc: Please identify a location so that time zone rules can be set correctly. Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean 11) none - I want to specify the time zone using the Posix TZ format. #? 5 3. Select country: China Please select a country. 1) Afghanistan 18) Israel 35) Palestine 2) Armenia 19) Japan 36) Philippines 3) Azerbaijan 20) Jordan 37) Qatar 4) Bahrain 21) Kazakhstan 38) Russia 5) Bangladesh 22) Korea (North) 39) Saudi Arabia 6) Bhutan 23) Korea (South) 40) Singapore 7) Brunei 24) Kuwait 41) Sri Lanka 8) Cambodia 25) Kyrgyzstan 42) Syria 9) China 26) Laos 43) Taiwan 10) Cyprus 27) Lebanon 44) Tajikistan 11) East Timor 28) Macau 45) Thailand 12) Georgia 29) Malaysia 46) Turkmenistan 13) Hong Kong 30) Mongolia 47) United Arab Emirates 14) India 31) Myanmar (Burma) 48) Uzbekistan 15) Indonesia 32) Nepal 49) Vietnam 16) Iran 33) Oman 50) Yemen 17) Iraq 34) Pakistan #? 9 4. Select time zone: Beijing time Please select one of the following time zone regions. 1) east China - Beijing, Guangdong, Shanghai, etc. 2) Heilongjiang (except Mohe), Jilin 3) central China - Sichuan, Yunnan, Guangxi, Shaanxi, Guizhou, etc. 4) most of Tibet & Xinjiang 5) west Tibet & Xinjiang #? 1 5. Confirmation and verification: The following information has been given: China east China - Beijing, Guangdong, Shanghai, etc. Therefore TZ='Asia/Shanghai' will be used. Local time is now: Tue Dec 17 18:22:10 CST 2013. Universal Time is now: Tue Dec 17 10:22:10 UTC 2013. Is the above information OK? 1) Yes 2) No #? 1 You can make this change permanent for yourself by appending the line TZ='Asia/Shanghai'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts: Asia/Shanghai 6. Copy the file to the /etc directory sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 7. Update Time sudo ntpdate time.windows.com 8. After modifying the time, modify the time of the hardware CMOS sudo hwclock --systohc Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: mysql add, delete, modify and query basic statements
>>: JS implements simple example code to control video playback speed
Navigation bar creation: Technical requirements: ...
1. Problem Description When starting MYSQL, a pro...
This article introduces blue-green deployment and...
Absolute, relative and fixed in position position...
The Docker container provides services and listen...
Vertical Split Vertical splitting refers to the s...
The following two errors were encountered when co...
Table of contents Problem Description The general...
1. Set up HOST on the host Macbook The previous d...
Responsive layout systems are already very common...
Table of contents 1. Some concepts of Tomcat –1, ...
Part of the code: Copy code The code is as follow...
Install using the MSI installation package Downlo...
Table of contents 1. Compiler code format specifi...
Rendering After looking up relevant information o...