Linux系统下查看系统时间和硬件时间
1.具体命令使用如下:
查看当前系统时间
[root@littlelawson hbase-1.4.0]# date
Mon Jun 18 10:36:45 PDT 2018
设置系统时间
[root@littlelawson hbase-1.4.0]# date -s 21:48:00
Mon Jun 18 21:48:00 PDT 2018
查看当前硬件时间
[root@littlelawson hbase-1.4.0]# hwclock
Mon 18 Jun 2018 09:51:01 PM PDT -0.969901 seconds
设置硬件时间,‘月/日/年 时分’
[root@littlelawson hbase-1.4.0]# hwclock --set --date=‘06/18/18 21:50’
[root@littlelawson hbase-1.4.0]# hwclock --systohc
[root@littlelawson hbase-1.4.0]# hwclock
daMon 18 Jun 2018 09:52:23 PM PDT -0.391427 seconds
[root@littlelawson hbase-1.4.0]# date
Mon Jun 18 21:52:23 PDT 2018
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
2.关于hwclock[hardware clock]命令
-s, --hctosys
Set the System Time from the Hardware Clock.#以硬件时间为标准,设置系统时间
Also set the kernel’s timezone value to the local timezone as
indicated by the TZ environment variable and/or
/usr/share/zoneinfo, as tzset(3) would interpret them. The
obsolete tz_dsttime field of the kernel’s timezone value is
set to DST_NONE. (For details on what this field used to
mean, see settimeofday(2).)
This is a good option to use in one of the system startup
scripts.
-w, --systohc
Set the Hardware Clock to the current System Time.##以系统时间为标准,设置硬件时间