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 set hardware time with Linux hwclock command

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

Share

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

This article introduces the knowledge about "how to set hardware time with Linux hwclock command". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Linux common command hwclock command is a hardware clock access tool, it can display the current time, set the hardware clock time and set the hardware clock to the system time, can also set the system time to the hardware clock time.

hwclock display and set hardware clock

The hwclock command is a hardware clock access tool that can display the current time, set the hardware clock time, and set the hardware clock to system time, as well as set the system time to hardware clock time.

There are two types of clock in Linux: hardware clock and system clock. Hardware clock refers to the clock device on the motherboard, that is, the clock that can usually be set in the BIOS screen. The system clock is the clock in the kernel. When Linux starts, the system clock reads the hardware clock settings, and then the system clock runs independently. All Linux-related commands and functions read the settings of the system clock.

Syntax hwclock(option) option--adjust: hwclock Every time the hardware clock is changed, it is recorded in the/etc/adjtime file. Use the--adjust parameter to enable hwclock to estimate the hardware clock bias based on previous records and use it to correct the current hardware clock; --debug: displays detailed information about hwclock execution; --directisa: hwclock defaults to accessing hardware clocks from/dev/rtc devices. If access is not possible, this parameter can be used to access the hardware clock directly with I/O instructions; --hctosys: adjust the system clock to match the current hardware clock; --set --date=: set the hardware clock; --show: display the time and date of the hardware clock; --systohc: adjust the hardware clock to match the current system clock; --test: test the program only, without actually changing the hardware clock; --utc: To use Greenwich Time, add this parameter, hwclock performs the conversion; --version: Displays version information. Example setting hardware time depends on operating system time, as follows:

hwclock-systohc hwclock --systohc--utc without any parameters Use hwclock to view the current hardware date and time.

hwclock Check the clock file to make sure UTC is set:

cat /etc/default/rcS UTC=yes In some other versions of Linux, such as RebHat, you can see this:

cat /etc/sysconfig/clock ZONE="America/Los_Angeles" UTC=false ARC=false"How to set hardware time with Linux hwclock command" is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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