node103.html

来自「Linux帮助文档之系统管理员手册」· HTML 代码 · 共 82 行

HTML
82
字号
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<html>
<head>
<title>Showing and setting time</title>
<meta NAME="description" CONTENT="Showing and setting time">
<meta NAME="keywords" CONTENT="sag">
<meta NAME="resource-type" CONTENT="document">
<meta NAME="distribution" CONTENT="global">
<link REL="STYLESHEET" HREF="sag.css">
</head>
<body LANG="EN">
 <a NAME="tex2html1592" HREF="node104.html"><img WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" ALT="next" SRC="./next_motif.gif"></a> <a NAME="tex2html1590" HREF="node100.html"><img WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" ALT="up" SRC="./up_motif.gif"></a> <a NAME="tex2html1584" HREF="node102.html"><img WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" ALT="previous" SRC="./previous_motif.gif"></a> <a NAME="tex2html1594" HREF="node1.html"><img WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" ALT="contents" SRC="./contents_motif.gif"></a> <a NAME="tex2html1595" HREF="node108.html"><img WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" ALT="index" SRC="./index_motif.gif"></a> <br>
<b> Next:</b> <a NAME="tex2html1593" HREF="node104.html">When the clock is </a>
<b>Up:</b> <a NAME="tex2html1591" HREF="node100.html">Keeping Time</a>
<b> Previous:</b> <a NAME="tex2html1585" HREF="node102.html">The hardware and software </a>
<br> <p>
<h1><a NAME="SECTION001130000000000000000">显示和设置时钟</a></h1>
<p>
在Debian系统中,系统时区由符号连接<tt>/etc/localtime</tt><a NAME="2804">&nbsp;</a>决定。
连接指向描述本地时区的时区数据文件。时区数据文件存在<tt>/usr/lib/zoneinfo</tt><a NAME="2806">&nbsp;</a>中。
其他Linux distributions可能不同。
<p>用户可以用设置TZ环境变量来改变他的私人时区。如果不设置,就假定是系统时区。
TZ变量的语法在<em>tzset</em><a NAME="2808">&nbsp;</a>(3)man页中说明。
<p>
<tt>date</tt><a NAME="2810">&nbsp;</a>命令显示当前日期和时间。
<a NAME="tex2html46" HREF="footnode.html#2802"><img ALIGN="BOTTOM" ALT="gif" SRC="./foot_motif.gif" WIDTH="15" HEIGHT="15"></a>
例如:
<blockquote> <tt>
<code>$</code> <i>date</i> <br> 
<code>Sun Jul 14 21:53:41 EET DST 1996</code> <br> 
<code>$</code>
</tt></blockquote>
That time is Sunday, 14th of July, 1996, at about ten before ten at the evening, 
in the time zone called ``EET DST''
(which might be East European Daylight Savings Time).
<tt>date</tt><a NAME="2814">&nbsp;</a>也可用于显示通用时间:
<blockquote> <tt>
<code>$</code> <i>date -u</i> <br> 
<code>Sun Jul 14 18:53:42 UTC 1996</code> <br> 
<code>$</code>
</tt></blockquote>
<tt>date</tt><a NAME="2816">&nbsp;</a>也可用于设置核心的软件始终:
<blockquote> <tt>
<code>#</code> <i>date 07142157</i> <br> 
<code>Sun Jul 14 21:57:00 EET DST 1996</code> <br> 
<code>#</code> <i>date</i> <br> 
<code>Sun Jul 14 21:57:02 EET DST 1996</code> <br> 
<code>#</code>
</tt></blockquote>
更详细的见<tt>date</tt><a NAME="2818">&nbsp;</a>man页--syntax is a bit arcane. 
只有<tt>root</tt>能设置时间。虽然每个用户可以有自己的时区,但
时钟对每个人都是一样的。
<p>
<tt>date</tt><a NAME="2820">&nbsp;</a>只显示或设置软件时钟。
<tt>clock</tt><a NAME="2822">&nbsp;</a>命令同步硬件和软件时钟。
用于系统启动时读取硬件时钟和设置软件时钟。如果两个时钟都需要设置,
则先用<tt>date</tt><a NAME="2824">&nbsp;</a>设置软件时钟,然后用<tt>clock -w</tt>
设置硬件时钟。
<p>
<tt>clock</tt><a NAME="2826">&nbsp;</a>的<tt>-u</tt>告诉它硬件时钟是通用时间。
<em>必须</em>正确使用<tt>-u</tt>选项。否则计算机将困惑到底是什么时间。
<p>
时钟必须小心改变。Unix系统的许多部分要求时钟工作正常。例如,
<tt>cron</tt><a NAME="2828">&nbsp;</a>守侯程序周期地运行命令。
如果改变时钟,它可能迷惑它是否该运行命令。
On one early Unix system, someone set the clock twenty years into the future, 
and <tt>cron</tt><a NAME="2830">&nbsp;</a> wanted to run all the periodic commands for twenty years all at once.
现在版本的<tt>cron</tt><a NAME="2832">&nbsp;</a>可以正确处理,
但仍然要小心。大的前后跳跃比小的更危险。
<p>
<hr><a NAME="tex2html1592" HREF="node104.html"><img WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" ALT="next" SRC="./next_motif.gif"></a> <a NAME="tex2html1590" HREF="node100.html"><img WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" ALT="up" SRC="./up_motif.gif"></a> <a NAME="tex2html1584" HREF="node102.html"><img WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" ALT="previous" SRC="./previous_motif.gif"></a> <a NAME="tex2html1594" HREF="node1.html"><img WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" ALT="contents" SRC="./contents_motif.gif"></a> <a NAME="tex2html1595" HREF="node108.html"><img WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" ALT="index" SRC="./index_motif.gif"></a> <br>
<b> Next:</b> <a NAME="tex2html1593" HREF="node104.html">When the clock is </a>
<b>Up:</b> <a NAME="tex2html1591" HREF="node100.html">Keeping Time</a>
<b> Previous:</b> <a NAME="tex2html1585" HREF="node102.html">The hardware and software </a>
<p><address>
<i>Lars Wirzenius <br>
Sun Jun 29 13:31:22 EEST 1997</i>
</address>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?