1. Time types are divided into: 1. Network time (set time zone, time synchronized by ntp server) 2. System time, the time displayed by the current system 3. Hardware (RTC) time, Bios time on the motherboard The general settings are: system time is synchronized with network time, and system time is written into hardware time. 2. How to view the time: 1. Check the hardware time #hwclock 2. Check the system time date 3. Update and check network time #ntpdate xxxxxx xxxxxx is the time server set in the /etc/ntp.conf file 4. How to modify the time 1. Modification of system time Set the time to 13:11:03 #date -s 13:11:03 2. Hardware time modification #hwclock --set --date='03/21/2019 15:20'; Set the hardware time to 15:20 on March 21, 2019 3. Modification of network time 1. The network time needs to be modified by changing the time zone. tzselect If you are not sure about the time zone, you need to use this command to find your time zone. 2. Most Chinese users use Asia/Shanghai, so use the following command to update to Shanghai time zone #cp -v /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 3. Synchronize time with the network server #ntpdate xxxxxx xxxxxx is the time server set in the /etc/ntp.conf file 5. Time write to each other 1. Hardware time is written to system time #hwclock -s 2. System time synchronizes network time #ntpdate xxxxxx xxxxxx is the time server set in the /etc/ntp.conf file 3. System time is written to hardware time #hwclock -w 6. Causes and solutions to the dual system time error problem 1. Hardware time format 1. Local time: localtime (the time used by Windows) 2. World Standard Time: UTC (the time used by Linux/Unix) 2. Differences between Windows and Linux/Unix in interpreting hardware time Windows uses localtime as the system time Linux/Unix uses the time converted from UTC (Universal Standard Time) and the time zone as the system time. Since Beijing time uses the Eastern Time Zone 8, the system time is converted from UTC+8. 3. Reasons for time discrepancy between Windows and Linux/Unix When using the Windows system, the localtime is written into the hardware time while synchronizing the time with the network (note that the Windows system time and the hardware time are synchronized to the same time at this time). When using the Linux/Unix setting, the hardware time is UTC time, so it adds 8 hours to the correct time that has been synchronized, and vice versa, resulting in time error. 4.Solution to time discrepancy between Windows and Linux/Unix Method 1. Windows: 1. Use UTC time as local time Method 2. Linux: 1. Use localtime as hardware time (suitable for Linux distributions that use systemd to manage services) 2. Use network time as local time and do not synchronize with hardware time (applicable to Linux distributions that use init management services) Most distributions currently use systemd as the service manager. 5. Specific operations of time difference between Windows and Linux/Unix Method 1: Windows 1. Open cmd as administrator implement: Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1 Method 2: Linux 1. Use localtime as hardware time (suitable for Linux distributions that use systemd to manage services) #hwclock --localtime or
2. Set Linux not to use hardware time synchronization (applicable to Linux distributions that use init management services)
If there is anything missing, please comment and supplement! 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. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: Nine advanced methods for deduplicating JS arrays (proven and effective)
>>: The perfect solution to the error of installing Mysql Applying Security in windows server2014
In many cases, in order to beautify the form, the ...
Table of contents Function definition method Func...
Question 1: When entering net start mysql during ...
Table of contents 1. Conditional access attribute...
Preface: In MySQL, the system supports many chara...
As a useful terminal emulator, Xshell is often us...
1. Overview The information_schema database is th...
In the previous blog, we talked about using Nginx...
This article introduces how to configure Nginx to...
Preface When Ahhang was developing the Springboot...
Recently, the company is preparing to develop an ...
Detailed explanation of the order of Mysql query ...
This article shares the specific code of JavaScri...
I personally feel that the development framework ...
I won’t go into details about the theory of UDP. ...