Linux下设置日期和时间的一些步骤

时间:2018-01-14 15:02来源:网络整理 作者:Linux先生 举报 点击:
以下内容是关于帮助你在Linux下设置日期和时间的一些步骤,重庆幸运农场开到晚上几点:也包含了一点ntpd时间同步的内容。特别提醒的是在发行版本的限制是red hat系列,包括fedora,centos,r

本文地址:http://www.kooct.com/install/config/2018/0114/17414.html
文章摘要:,放风筝提供线索太空,染色机动网论坛意向者。

以下内容是关于帮助你在Linux下设置日期和时间的一些步骤,也包含了一点ntpd时间同步的内容。特别提醒的是在发行版本的限制是red hat系列,包括fedora,centos,redflag,unbreakable linux等。

There are two clocks to configure in Linux, the hardware clock and the system clock. The hardware clock determines the system clock on system boot. While the system is running, changes to one of these doesn't affect the other.

在Linux下有两个时钟需要配置,硬件时钟和系统时钟。硬件时钟在系统启动时决定系统时钟,当系统处于运行状态下时,修改其中任何一个并不能对另一个默认生效。

Note: it's best to set the hardware clock and have the system clock be set upon a reboot. Changing the system clock by using the date program on a running system could cause date discontinuities and consequently problems. If you will be using ntpd, you probably don't need to set either of these clocks (unless the current time is more than 1000s off the real time). Just setup ntpd and let ntpd adjust the time (it will do it in small steps to keep system timestamps reliable).

现在大部分的发行版本在图形界面下都提供了时钟设置工具,例如kde,gnome都有友好的 图形化工具,这里就不多说了。

You can use timeconfig to configure the timezone and UTC settings. Timeconfig will update /etc/sysconfig/clock and /etc/localtime.

Set the time zone manually if not already set.

Linux uses the file /etc/localtime to determine the time zone. This file should be either a copy of the appropriate timezone file from the directory /usr/share/zoneinfo or a symbolic link. If your time zone is incorrect, create a symbolic link to the appropriate timezone file.

# ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Set whether hwclock uses local time or UTC
Edit the file /etc/sysconfig/clock and change "UTC=" to true or false.
If you have a dual-boot system with Windows, using UTC may cause problems for Windows.
Set the system clock
# date MMDDhhmmCCYY.ss
where MM is month, DD is day, hh is hour, mm is minutes,
CCYY is year and ss is seconds. Time should be in 24-hour notation.
To only set the time:
# date -s hh:mm:ss
Set the hardware clock
To set the hardware clock to the current system clock:
# setclock
this method looks at /etc/sysconfig/clock to determine whether the hardware clock is set to UTC
Another method:
# hwclock --systohc# hwclock --systohc --utc
use the second option if you use UTC.
Set hwclock manually:
# hwclock --set --date="9/22/96 16:45:05"
Everytime you use the hwclock --set command,
it will create or edit the file /etc/adjtime to determine the systematic drift.
Once you have some history,
you can use the --adjust option to adjust the hardware clock appropriately.
Run as a cron job if you want the clock to adjust automatically on a regular schedule.
Don't use the --adjust function when using ntpd since ntpd will turn the "11 minute mode" on,
which is best left alone. See the hwclock manpage for more info.
Setup ntpd for automatic synchronization with a remote server.
Run Red Hat's setup utility to make ntpd start on boot up and edit /etc/ntp.conf
Set server and fudge options:
server time.nist.govfudge time.nist.gov stratum 10
Enable multicastclient:
multicastclient   # listen on default 224.0.1.1
Edit /etc/sysconfig/ntpd if necessary. The default should be fine.
Start the ntpd daemon:
# service ntpd start

------分隔线----------------------------
推荐内容
重庆幸运农场最新开奖结果走势图 幸运飞艇1之6名如何算 重庆幸运农场app 重庆幸运农场手机版 麻将东南西北中发白
幸运农场追号技巧 幸运农场速查表 重庆幸运农场破解技巧 幸运农场最长龙 重庆幸运农场开奖历史开奖结果
重庆彩票幸运农场走势图 重庆快乐十分走势图表 重庆幸运农场机器人 幸运农场开奖公告 幸运农场五复式
幸运农场20选8如何选号 幸运农场万能码 幸运飞船计划 幸运农场十样玩法 重庆幸运农场开奖记录
福利彩票36选7开奖结果 云南时时彩奖项规则 湖北11选5开奖公告 山东11选5开奖结果查询 斗地主获胜的六条口诀
新疆时时彩五星基本 河北十一选五开奖结果 上海时时乐中彩网 双色球走势图2元网 湖北快三豹子遗漏
极速时时彩怎么赢 广西快乐十分规律 麻将牌技作弊 辽宁11选5前三遗漏 快乐10分开奖结果查询
途游炸金花 澳洲快乐8计划软件手机版下载 浙江快乐12玩法介绍 山东群英会任2胆拖 吉林快三预测软件