📄 stddate_details.html
字号:
<!-- saved from url=(0022)http://internet.e-mail -->
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=GB2312">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 9">
<meta name=Originator content="Microsoft Word 9">
<link rel=Edit-Time-Data href="./stddate_details.files/editdata.mso">
<!--[if gte mso 9]><xml>
<o:DocumentProperties>
<o:Author>Vic</o:Author>
<o:LastAuthor>Vic</o:LastAuthor>
<o:Revision>14</o:Revision>
<o:TotalTime>122</o:TotalTime>
<o:Created>2004-10-18T15:59:00Z</o:Created>
<o:LastSaved>2004-10-19T03:08:00Z</o:LastSaved>
<o:Pages>4</o:Pages>
<o:Words>625</o:Words>
<o:Characters>3566</o:Characters>
<o:Company>Home</o:Company>
<o:Lines>29</o:Lines>
<o:Paragraphs>7</o:Paragraphs>
<o:CharactersWithSpaces>4379</o:CharactersWithSpaces>
<o:Version>9.2812</o:Version>
</o:DocumentProperties>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:PunctuationKerning/>
<w:DrawingGridVerticalSpacing>7.8 磅</w:DrawingGridVerticalSpacing>
<w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery>
<w:DisplayVerticalDrawingGridEvery>2</w:DisplayVerticalDrawingGridEvery>
<w:Compatibility>
<w:SpaceForUL/>
<w:BalanceSingleByteDoubleByteWidth/>
<w:DoNotLeaveBackslashAlone/>
<w:ULTrailSpace/>
<w:DoNotExpandShiftReturn/>
<w:AdjustLineHeightInTable/>
<w:UseFELayout/>
</w:Compatibility>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:黑体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimHei;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:1 135135232 16 0 262144 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@黑体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:1 135135232 16 0 262144 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
h1
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
mso-outline-level:1;
font-size:24.0pt;
font-family:宋体;
mso-font-kerning:18.0pt;
font-weight:bold;}
h2
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
mso-outline-level:2;
font-size:18.0pt;
font-family:宋体;
font-weight:bold;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
text-decoration:underline;
text-underline:single;}
p
{margin-right:0cm;
mso-margin-top-alt:auto;
mso-margin-bottom-alt:auto;
margin-left:0cm;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:宋体;
mso-bidi-font-family:"Times New Roman";}
pre
{margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt;
font-size:10.0pt;
font-family:黑体;
mso-hansi-font-family:"Courier New";
mso-bidi-font-family:"Courier New";}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:595.3pt 841.9pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:42.55pt;
mso-footer-margin:49.6pt;
mso-paper-source:0;
layout-grid:15.6pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body lang=ZH-CN link=blue vlink=blue style='tab-interval:21.0pt;text-justify-trim:
punctuation'>
<div class=Section1 style='layout-grid:15.6pt'>
<table border=0 cellpadding=0 width="100%" bgcolor="#eeeeff" style='width:100.0%;
mso-cellspacing:1.5pt;background:#EEEEFF;mso-padding-alt:0cm 0cm 0cm 0cm'>
<tr>
<td style='padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><span lang=EN-US><a href="index.html">cppreference.com</a>
-> <a href="stddate.html"><span style='font-family:宋体;mso-ascii-font-family:
"Times New Roman";mso-hansi-font-family:"Times New Roman"'>标准</span>c<span
style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"'>时间与日期函数</span></a> -> </span><span style='font-family:
宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:"Times New Roman"'>详解</span>
<span lang=EN-US style='font-size:12.0pt;font-family:宋体'><o:p></o:p></span></p>
</td>
</tr>
</table>
<h1>标准<span lang=EN-US>c时间与日期函数</span></h1>
<div class=MsoNormal align=center style='text-align:center'><span lang=EN-US>
<hr size=2 width="100%" align=center>
</span></div>
<h2><span lang=EN-US><a name="asctime">asctime</a> </span></h2>
<p class=MsoNormal><i><span style='font-family:宋体;mso-ascii-font-family:"Times New Roman";
mso-hansi-font-family:"Times New Roman"'>语法</span><span lang=EN-US>:</span></i><span
lang=EN-US> </span></p>
<table border=0 cellpadding=0 bgcolor="#ccccff" style='mso-cellspacing:1.5pt;
background:#CCCCFF;mso-padding-alt:0cm 0cm 0cm 0cm'>
<tr>
<td style='padding:.75pt .75pt .75pt .75pt'><pre><span lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></pre><pre><span
lang=EN-US><span style="mso-spacerun: yes"> </span>#include <time.h></span></pre><pre><span
lang=EN-US><span style="mso-spacerun: yes"> </span>char *asctime( const struct tm *ptr );</span></pre></td>
</tr>
</table>
<p>功能: 函数将<i><span lang=EN-US>ptr</span></i>所指向的时间结构转换成下列字符串: </p>
<pre><span lang=EN-US><span style="mso-spacerun: yes"> </span>day month date hours:minutes:seconds year\n\0</span></pre>
<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>例如<span
lang=EN-US>: </span></p>
<pre><span lang=EN-US><span style="mso-spacerun: yes"> </span>Mon Jun 26 12:03:53 2000</span></pre>
<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"'>相关主题</span><span lang=EN-US>:</span></i><span lang=EN-US><br>
<strong><a href="#localtime">localtime()</a>, <a href="#gmtime">gmtime()</a>, <a
href="#time">time()</a>, and <a href="#ctime">ctime()</a>. </strong></span></p>
<div class=MsoNormal align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
lang=EN-US>
<hr size=2 width="100%" align=center>
</span></div>
<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
lang=EN-US><a name="clock">clock</a> </span></h2>
<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"'>语法</span><span lang=EN-US>:</span></i><span lang=EN-US> </span></p>
<table border=0 cellpadding=0 bgcolor="#ccccff" style='mso-cellspacing:1.5pt;
background:#CCCCFF;mso-padding-alt:0cm 0cm 0cm 0cm'>
<tr>
<td style='padding:.75pt .75pt .75pt .75pt'><pre><span lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></pre><pre><span
lang=EN-US><span style="mso-spacerun: yes"> </span>#include <time.h></span></pre><pre><span
lang=EN-US><span style="mso-spacerun: yes"> </span>clock_t clock( void );</span></pre></td>
</tr>
</table>
<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>功能:
函数返回自程序开始运行的处理器时间,如果无可用信息,返回<span lang=EN-US>-1。 转换返回值以秒记, 返回值除以CLOCKS_PER_SECOND.
(注: 如果编译器是POSIX兼容的, CLOCKS_PER_SECOND定义为1000000.) </span></p>
<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"'>相关主题</span><span lang=EN-US>:</span></i><span lang=EN-US><br>
<strong><a href="#time">time()</a>, <a href="#asctime">asctime()</a>, and <a
href="#ctime">ctime()</a>. </strong></span></p>
<div class=MsoNormal align=center style='text-align:center;tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
lang=EN-US>
<hr size=2 width="100%" align=center>
</span></div>
<h2 style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><span
lang=EN-US><a name="ctime">ctime</a> </span></h2>
<p class=MsoNormal style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'><i><span
style='font-family:宋体;mso-ascii-font-family:"Times New Roman";mso-hansi-font-family:
"Times New Roman"'>语法</span><span lang=EN-US>:</span></i><span lang=EN-US> </span></p>
<table border=0 cellpadding=0 bgcolor="#ccccff" style='mso-cellspacing:1.5pt;
background:#CCCCFF;mso-padding-alt:0cm 0cm 0cm 0cm'>
<tr>
<td style='padding:.75pt .75pt .75pt .75pt'><pre><span lang=EN-US><![if !supportEmptyParas]> <![endif]><o:p></o:p></span></pre><pre><span
lang=EN-US><span style="mso-spacerun: yes"> </span>#include <time.h></span></pre><pre><span
lang=EN-US><span style="mso-spacerun: yes"> </span>char *ctime( const time_t *time );</span></pre></td>
</tr>
</table>
<p style='tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt'>功能:
函数转换参数<i><span lang=EN-US>time</span></i>为本地时间格式:</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -