<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>风叶 &#187; 时间同步</title>
	<atom:link href="http://blog.myhnet.cn/tag/%e6%97%b6%e9%97%b4%e5%90%8c%e6%ad%a5/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.myhnet.cn</link>
	<description>秋湍泻石髓 风叶聚云根</description>
	<lastBuildDate>Fri, 20 Aug 2010 15:05:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>如何Linux下修改系统时间</title>
		<link>http://blog.myhnet.cn/2008/12/30/how-to-set-the-date-on-your-linux-machine/</link>
		<comments>http://blog.myhnet.cn/2008/12/30/how-to-set-the-date-on-your-linux-machine/#comments</comments>
		<pubDate>Tue, 30 Dec 2008 05:03:48 +0000</pubDate>
		<dc:creator>myhnet</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[硬件时间]]></category>
		<category><![CDATA[系统时间]]></category>
		<category><![CDATA[网络时间]]></category>
		<category><![CDATA[网络时间协议]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[linux系统时间设置]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[ntpdate]]></category>
		<category><![CDATA[ubuntu系统时间设置]]></category>
		<category><![CDATA[时间设置]]></category>
		<category><![CDATA[时间同步]]></category>
		<category><![CDATA[修改]]></category>

		<guid isPermaLink="false">http://blog.myhnet.cn/?p=314</guid>
		<description><![CDATA[首先，可以直接利用date命令来显示当前的系统时间 # dateMon Dec 22 22:35:58 IST 2008 如果你想把系统时间改为2008年圣诞节的下午一点四十五的话，你可以利用下面的命令： # date -s “25 DEC 2008 13:45:00″Thu Dec 25 13:45:02 IST 2008 尽量上面这个命令的格式已经很形象了，我这里还是做一下说明。最前面的当然就是date命令了，后面跟着的“-s”选项，表示你要修改时间。最后面跟的就是你要设置的时间 了，时间必须参照这个格式 &#8220;日 月 年 小时:分钟:秒 ”。回车之后，系统时间就会被修改了。你可以再次输入date命令检查一下。 还有许多方法可以达到这个目的，你可以参考一下date命令的man page。比如下面这个命令，可以把系统日期调整到2008年12月25日： #date +%Y%m%d -s “20081225″ 我们还可以实时地从NTP（Netwokr Time Protocol，网络时间协议）服务器上同步我们的系统时间。大多数的linux系统都可以运行NTPd这个守护进程，我们只要正确的配置好NTPd，就可以通过网络（LAN鴶Internet）在时间服务器上同步我们的时间。这种方式在生产机器上用得非常广泛。 通常来说，现在的Linux系统默认都安装了NTP。如果没有的话，我们可以用下面的方式来安装： Ubuntu用户 # sudo apt-get install ntpdate Fedora用户 # yum install ntp 安装好NTP之后，我们要配置一下这个文件 /etc/ntp.conf 找这个文件中含有Server参数的一行，将其改为： server pool.ntp.org 在中国也可以用下面几行代替 [...]]]></description>
			<content:encoded><![CDATA[<p>首先，可以直接利用date命令来显示当前的系统时间</p>
<div class="hl-surround"><div class="hl-main"># date<br />Mon Dec 22 22:35:58 IST 2008</div></div>
<p>如果你想把系统时间改为2008年圣诞节的下午一点四十五的话，你可以利用下面的命令：</p>
<div class="hl-surround"><div class="hl-main"># date -s “25 DEC 2008 13:45:00″<br />Thu Dec 25 13:45:02 IST 2008</div></div>
<p>尽量上面这个命令的格式已经很形象了，我这里还是做一下说明。最前面的当然就是date命令了，后面跟着的“-s”选项，表示你要修改时间。最后面跟的就是你要设置的时间 了，时间必须参照这个格式 &#8220;日 月 年  小时:分钟:秒 ”。回车之后，系统时间就会被修改了。你可以再次输入date命令检查一下。</p>
<p>还有许多方法可以达到这个目的，你可以参考一下date命令的man page。比如下面这个命令，可以把系统日期调整到2008年12月25日：</p>
<div class="hl-surround"><div class="hl-main">#date +%Y%m%d -s “20081225″</div></div>
<p>我们还可以实时地从NTP（Netwokr Time Protocol，网络时间协议）服务器上同步我们的系统时间。大多数的linux系统都可以运行NTPd这个守护进程，我们只要正确的配置好NTPd，就可以通过网络（LAN鴶Internet）在时间服务器上同步我们的时间。这种方式在生产机器上用得非常广泛。</p>
<p>通常来说，现在的Linux系统默认都安装了NTP。如果没有的话，我们可以用下面的方式来安装：<br />
Ubuntu用户</p>
<div class="hl-surround"><div class="hl-main"># sudo apt-get install ntpdate</div></div>
<p>Fedora用户</p>
<div class="hl-surround"><div class="hl-main"># yum install ntp</div></div>
<p>安装好NTP之后，我们要配置一下这个文件<br />
<code>/etc/ntp.conf </code><br />
找这个文件中含有Server参数的一行，将其改为：</p>
<div class="hl-surround"><div class="hl-main">server pool.ntp.org</div></div>
<p>在中国也可以用下面几行代替</p>
<div class="hl-surround"><div class="hl-main">server 1.cn.pool.ntp.org<br />	&nbsp; &nbsp;server 0.asia.pool.ntp.org<br />	&nbsp; &nbsp;server 2.asia.pool.ntp.org</div></div>
<p>保存文件，然后重启NTP服务</p>
<div class="hl-surround"><div class="hl-main"># /etc/init.d/ntpd restart</div></div>
<p>当然，也可以用下面的命令手动进行时间同步：</p>
<div class="hl-surround"><div class="hl-main"># ntpdate pool.ntp.org<br />22 Dec 23:07:00 ntpdate[24328]: step time server 123.108.39.80 offset 172868.246157 sec</div></div>
<p>如果你要将系统时间保存到硬件上面，使其重启时仍然有然，可以使用下列命令：</p>
<div class="hl-surround"><div class="hl-main"># hwclock --systohc</div></div>
<p>如果你使用的是linux与windows双系统的时候出现了时间差的问题（windows时间与linux时间不一致），可以看我以前写过的一篇文章：<br />
<a href="http://blog.myhnet.cn/2007/11/13/problem-on-ubuntu-time-setting/">ubuntu系统时间设置问题</a></p>
<p>参考：<a href="http://www.simplehelp.net/2008/12/23/setting-the-date-on-your-linux-machine">http://www.simplehelp.net/2008/12/23/setting-the-date-on-your-linux-machine</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.myhnet.cn/2008/12/30/how-to-set-the-date-on-your-linux-machine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
