Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command clock in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "Linux common command clock how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "Linux common command clock how to use" this article.

Linux commonly used command clock command is used to adjust the RTC time. RTC is the built-in hardware time of the computer. Executing this instruction can display the present time, adjust the time of the hardware clock, set the system time to the same time as the hardware clock, or save the system time back to the hardware clock.

Syntax clock [--adjust] [--debug] [--directisa] [--getepoch] [--hctosys] [--set-- date= ""] [--setepoch-- epoch=] [--show] [--systohc] [--test] [--utc] [--version] parameter description:

The first time adjust uses the "- set" or "- systohc" parameters to set the hardware clock, it produces a file named adjtime in the / etc directory. When you use these two parameters to adjust the hardware clock again, this file will record the difference between the two adjustments. When you execute the clock instruction plus the "- adjust" parameter in the future, the program will automatically calculate the average value according to the numerical difference of the record file, and automatically adjust the time of the hardware clock.

-debug shows the instruction execution process in detail, which is easy to debug or understand the execution of the program.

-directisa tells clock not to access the hardware clock directly through the / dev/rtc device file. This parameter applies to older computers with only ISA bus structures.

-getepoch presents the new era value of the hardware clock in the core of the system to the standard output device.

-hctosys Hardware Clock to System Time, set the system time to be consistent with the hardware clock. Since this action will cause the system to fully update the access time of the file, it is best to execute it when the system starts.

-set-date sets the date and time of the hardware clock.

-setepoch-epoch= sets the new era value of the hardware clock of the system core, and the year is represented by four-digit tree words.

-show reads the time of the hardware clock and renders it to the standard output device.

-systohc System Time to Hardware Clock to save the system time back to the hardware clock.

-test is only for testing and does not really write time to the hardware clock or system time.

-utc refers to the time on the hardware clock as CUT, sometimes called UTC or UCT.

-version displays version information.

The reference example shows the current hardware clock time:

[root@linux265 ~] # clock on Thursday, December 12, 2019, 15:11:07-0.578708 seconds display utc hardware clock time:

[root@linux265 ~] # clock-- utc synchronization time on Thursday, December 12, 2019, 15:12:30-0.442566 seconds:

[root@linux265] # clock-the above is all the contents of the article "how to use clock in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report