Linux: time problems?

Source: Internet
Author: User

Overview:

Linux time is divided into: UTC time and local time. During installation, you are prompted to select a time representation, which is usually UTC time by default. Windows usually specifies a region during installation, so the time is the local time!

Generally, time-related commands support the display and setting of these two time periods. By default, local time is displayed!

 

Principle:

Generally, when using Linux, it is often found that the time is incorrect: The time in the BIOS is not the same as the time in the Linux system, that is, the time in the liunx and the time in the Windows system is incorrect, why ????

 

For Windows: BIOS <-----> wndows

When the OS is started, the BIOS read time is used as the system time. The region settings do not affect the time value. Windows Time is always local!

Command to modify the time of both Windows and BIOS

Region settings only affect information exchange in different time zones!

 

For Linux: BIOS <-------- [TZ] --------> liunx

When the OS is started, the time when the BIOS is read is used as the local time value of the system. The UTC time value of the system is obtained based on the region settings. The Linux time has two sets of standard time values.

The date command displays and modifies the Linux local time and UTC time, but does not modify the BIOS local time!

Hwclock displays and modifies the BIOS time, but does not affect the OS time!

 

FAQs:

How to view the BIOS (local) Time?

Hwclock -- show | hwclock-R

 

How does one display the BIOS time in UTC time?

Hwclock -- UTC | hwclock-u: 10 million note that the difference between the positive UTC time and the local time may not necessarily be the same as the time zone of your OS-because there is no relationship between the two; it refers to the difference value recorded in the/etc/adjtime file in the relevant hardware time information since you last adjusted the BIOS time (-- set | -- systohc | -- Adjust!

 

The BIOS time is inconsistent with the actual local time. How do I set the correct BIOS local time?

Hwclock -- set -- date = always a local time string # -- set and -- date options are always used together !" The local time string "means that the time string is not affected by the -- UTC option; its format is also very flexible!

 

The BIOS time is the correct local time. How can I set the correct local time according to the current OS time zone?

Hwclock -- hctosys

 

The BIOS time is the correct local time. How can I set the correct local UTC time based on the current OS time zone?

Hwclock -- mongoz

 

How can I view the local time of the current OS?

Date

 

How to view the UTC time of the current OS?

Date-u | date -- UTC | date -- Universal

 

Without considering the BIOS local time, how can I directly set the correct local time?

Date-s {time string | -- set = Time string}

 

Without considering the BIOS local time, how can I directly set the correct UTC time?

Date-U {-s time string | -- set = Time string}

 

How does one display the time in the specified format (local, UTC, modification time of the specified file, and time list of the file )?

-D | -- Date

-F | -- File

-R | -- Reference

Date option + time format standard string

 

How does one display time in RFC format?

RFC 2822 format: Id format of UTC time + Time Difference

Date-r | date -- rfc-2822

Date -- rfc-3339 = 'timespec'

 

 

How to obtain the most accurate time?

NTP protocol; NTP server (Internet time server); NTP client; synchronization time

Ntpdate

The widest, oldest, and well-known NTP servers:

Area: Hostname:
Worldwide Pool.ntp.org
Asia Asia.pool.ntp.org
Europe Europe.pool.ntp.org
North America North-america.pool.ntp.org
Oceania Oceania.pool.ntp.org
South America South-america.pool.ntp.org

 

Set up your own time server?

Required package: openntpd

Daemon (server process) ntpd

Daemon Configuration File:/etc/openntpd/ntpd. conf

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.