49.html
来自「linux 0.11中文版 有注释」· HTML 代码 · 共 75 行
HTML
75 行
<html>
<head>
<title>include/time.h</title>
<meta name='robots' content='noindex,nofollow'>
<meta name='generator' content='GLOBAL-5.4.1'>
</head>
<body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
<a name='TOP'><h2><a href='../mains.html'>root</a>/<a href='../files/99.html'>include</a>/time.h</h2>
<i><font color='green'>/* [<][>][^][v][top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
<hr>
<h2><a href='../J/49.html' title='Multiple included from 2 places.'>INCLUDED FROM</a></h2>
<hr>
<pre>
<a name='L1'><font color='darkred'>#ifndef</font> <a href='../S/49.html#L2' title='Defined at 2 in include/time.h.'>_TIME_H</a>
<a name='L2'><font color='darkred'>#define</font> <a href='../S/49.html#L1' title='Refered from 1 in include/time.h.'>_TIME_H</a>
<a name='L3'>
<a name='L4'><font color='darkred'>#ifndef</font> <a href='../D/607.html' title='Multiple defined in 2 places.'>_TIME_T</a>
<a name='L5'><font color='darkred'>#define</font> <a href='../R/358.html' title='Multiple refered from 2 places.'>_TIME_T</a>
<a name='L6'><b>typedef</b> <b>long</b> <a href='../R/703.html' title='Multiple refered from 19 places.'>time_t</a>; <i><font color='green'>// 从GMT 1970 年1 月1 日开始的以秒计数的时间(日历时间)。</font></i>
<a name='L7'><font color='darkred'>#endif</font>
<a name='L8'>
<a name='L9'><font color='darkred'>#ifndef</font> <a href='../D/595.html' title='Multiple defined in 4 places.'>_SIZE_T</a>
<a name='L10'><font color='darkred'>#define</font> <a href='../R/346.html' title='Multiple refered from 4 places.'>_SIZE_T</a>
<a name='L11'><b>typedef</b> <b>unsigned</b> <b>int</b> <a href='../R/611.html' title='Multiple refered from 2 places.'>size_t</a>;
<a name='L12'><font color='darkred'>#endif</font>
<a name='L13'>
<a name='L14'><font color='darkred'>#define</font> CLOCKS_PER_SEC 100 <i><font color='green'>// 系统时钟滴答频率,100HZ。</font></i>
<a name='L15'>
<a name='L16'><b>typedef</b> <b>long</b> <a href='../S/49.html#L33' title='Refered from 33 in include/time.h.'>clock_t</a>; <i><font color='green'>// 从进程开始系统经过的时钟滴答数。</font></i>
<a name='L17'>
<a name='L18'><b>struct</b> tm
<a name='L19'><font color='red'>{</font>
<a name='L20'> <b>int</b> tm_sec; <i><font color='green'>// 秒数 [0,59]。</font></i>
<a name='L21'> <b>int</b> tm_min; <i><font color='green'>// 分钟数 [ 0,59]。</font></i>
<a name='L22'> <b>int</b> tm_hour; <i><font color='green'>// 小时数 [0,59]。</font></i>
<a name='L23'> <b>int</b> tm_mday; <i><font color='green'>// 1 个月的天数 [0,31]。</font></i>
<a name='L24'> <b>int</b> tm_mon; <i><font color='green'>// 1 年中月份 [0,11]。</font></i>
<a name='L25'> <b>int</b> tm_year; <i><font color='green'>// 从1900 年开始的年数。</font></i>
<a name='L26'> <b>int</b> tm_wday; <i><font color='green'>// 1 星期中的某天 [0,6](星期天 =0)。</font></i>
<a name='L27'> <b>int</b> tm_yday; <i><font color='green'>// 1 年中的某天 [0,365]。</font></i>
<a name='L28'> <b>int</b> tm_isdst; <i><font color='green'>// 夏令时标志。</font></i>
<a name='L29'><font color='red'>}</font>;
<a name='L30'>
<a name='L31'><i><font color='green'>// 以下是有关时间操作的函数原型。</font></i>
<a name='L32'><i><font color='green'>// 确定处理器使用时间。返回程序所用处理器时间(滴答数)的近似值。</font></i>
<a name='L33'><a href='../S/49.html#L16' title='Defined at 16 in include/time.h.'>clock_t</a> clock (<b>void</b>);
<a name='L34'><i><font color='green'>// 取时间(秒数)。返回从1970.1.1:0:0:0 开始的秒数(称为日历时间)。</font></i>
<a name='L35'><a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> time (<a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> * tp);
<a name='L36'><i><font color='green'>// 计算时间差。返回时间time2 与time1 之间经过的秒数。</font></i>
<a name='L37'><b>double</b> difftime (<a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> time2, <a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> time1);
<a name='L38'><i><font color='green'>// 将tm 结构表示的时间转换成日历时间。</font></i>
<a name='L39'><a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> mktime (<b>struct</b> tm *tp);
<a name='L40'>
<a name='L41'><i><font color='green'>// 将tm 结构表示的时间转换成一个字符串。返回指向该串的指针。</font></i>
<a name='L42'><b>char</b> *asctime (<b>const</b> <b>struct</b> tm *tp);
<a name='L43'><i><font color='green'>// 将日历时间转换成一个字符串形式,如“Wed Jun 30 21:49:08:1993\n”。</font></i>
<a name='L44'><b>char</b> *ctime (<b>const</b> <a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> * tp);
<a name='L45'><i><font color='green'>// 将日历时间转换成tm 结构表示的UTC 时间(UTC - 世界时间代码Universal Time Code)。</font></i>
<a name='L46'><b>struct</b> tm *gmtime (<b>const</b> <a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> * tp);
<a name='L47'><i><font color='green'>// 将日历时间转换成tm 结构表示的指定时间区(timezone)的时间。</font></i>
<a name='L48'><b>struct</b> tm *localtime (<b>const</b> <a href='../D/1080.html' title='Multiple defined in 2 places.'>time_t</a> * tp);
<a name='L49'><i><font color='green'>// 将tm 结构表示的时间利用格式字符串fmt 转换成最大长度为smax 的字符串并将结果存储在s 中。</font></i>
<a name='L50'><a href='../D/979.html' title='Multiple defined in 4 places.'>size_t</a> strftime (<b>char</b> *s, <a href='../D/979.html' title='Multiple defined in 4 places.'>size_t</a> smax, <b>const</b> <b>char</b> *fmt, <b>const</b> <b>struct</b> tm *tp);
<a name='L51'><i><font color='green'>// 初始化时间转换信息,使用环境变量TZ,对zname 变量进行初始化。</font></i>
<a name='L52'><i><font color='green'>// 在与时间区相关的时间转换函数中将自动调用该函数。</font></i>
<a name='L53'><b>void</b> tzset (<b>void</b>);
<a name='L54'>
<a name='L55'><font color='darkred'>#endif</font>
</pre>
<hr>
<a name='BOTTOM'>
<i><font color='green'>/* [<][>][^][v]<a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?