增加 linux 时钟控制命令.
Signed-off-by: ithink.chan <chenyang@autoai.com>
This commit is contained in:
parent
1733ab1c4a
commit
277d242fa1
32
Software/Applications/Date/Date_命令使用说明.md
Normal file
32
Software/Applications/Date/Date_命令使用说明.md
Normal file
@ -0,0 +1,32 @@
|
||||
# Date 命令使用说明
|
||||
|
||||
Linux 一共有两个时钟,分别是:
|
||||
|
||||
* 硬件时钟:RTC=Real Time Clock,指主机板上的时钟设备,也就是通常可在BIOS画面设定的时钟。
|
||||
* 系统时钟:指 kernel 中的时钟。
|
||||
|
||||
当 Linux 启动时,系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。
|
||||
|
||||
Date 命令用于设置系统时钟。
|
||||
|
||||
## 显示日期与时间
|
||||
|
||||
```sh
|
||||
#显示当前日期与时间
|
||||
date
|
||||
# 显示 10s 后的日期与时间
|
||||
date -d "-10 second"
|
||||
# 显示后一天的日期与时间
|
||||
date -d "+1 day"
|
||||
# 显示上一月的日期与时间
|
||||
date -d "-1 month"
|
||||
# 显示下一年的日期与时间
|
||||
date -d "+1 year"
|
||||
```
|
||||
|
||||
## 设置日期与时间
|
||||
|
||||
```sh
|
||||
date -s "12:12:12"
|
||||
date -s "2016-12-07 12:00:00"
|
||||
```
|
29
Software/Applications/Hwclock/Hwclock_命令使用说明.md
Normal file
29
Software/Applications/Hwclock/Hwclock_命令使用说明.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Hwclock 命令使用说明
|
||||
|
||||
Linux一共有两个时钟,分别是:
|
||||
|
||||
* 硬件时钟:RTC=Real Time Clock,指主机板上的时钟设备,也就是通常可在BIOS画面设定的时钟。
|
||||
* 系统时钟:指kernel中的时钟。
|
||||
|
||||
当Linux启动时,系统时钟会去读取硬件时钟的设定,之后系统时钟即独立运作。
|
||||
|
||||
hwclock 命令用于查看或同步硬件时钟。
|
||||
|
||||
## 参数说明
|
||||
|
||||
```sh
|
||||
hwclock -h
|
||||
-r,--show 查看硬件时间
|
||||
-w,--systohc 将系统时钟写到硬件中
|
||||
-s,--hctosys 将硬件时钟写到系统上
|
||||
```
|
||||
|
||||
## 使用示例
|
||||
|
||||
```sh
|
||||
# 显示 RTC 时间
|
||||
hwclock
|
||||
hwclock -r
|
||||
# 将系统时钟写到硬件中
|
||||
hwclock -w
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user