Leo Zhang
菩提本无树,明镜亦非台!

常用操作

(1) 通过timedatectl管理时间

# 查看时间
timedatectl //等同于 timedatectl status
 
# 设置时间
timedatectl set-time "YYYY-MM-DD HH:MM:SS"
 
# 列出时区
timedatectl list-timezones
 
# 设置时区
timedatectl set-timezone Asia/Shanghai

 

(2) ntpdate时间同步

yum -y install ntpdate && ntpdate ntp1.aliyun.com
 
# 其他服务器
ntpdate us.pool.ntp.org
ntpdate hk.ntp.org.cn
ntpdate stdtime.gov.hk
0.asia.pool.ntp.org
1.asia.pool.ntp.org
📎ntpdate-4.2.6p5-29.el7.centos.2.x86_64.zip
 

(3) 通过date管理时间

# 查看时间
data -R
 
# 设置时间
date -s "YYYY-MM-DD HH:MM:SS"
 
# 设置时区
mv /etc/localtime /etc/localtime.bak
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

 

 

名词解释

UTC

整个地球分为二十四时区,每个时区都有自己的本地时间。在国际无线电通信场合,为了统一起见,使用一个统一的时间,称为通用协调时(UTC, Universal Time Coordinated)。

GMT

格林威治标准时间 (Greenwich Mean Time)指位于英国伦敦郊区的皇家格林尼治天文台的标准时间,因为本初子午线被定义在通过那里的经线。(UTC与GMT时间基本相同,本文中不做区分)

CST

中国标准时间 (China Standard Time)

DST

夏令时(Daylight Saving Time) 指在夏天太阳升起的比较早时,将时钟拨快一小时,以提早日光的使用。(中国不使用)
GMT + 8 = UTC + 8 = CST
 
 
posted on 2022-09-07 10:19  LeoZhanggg  阅读(342)  评论(0编辑  收藏  举报