📄 clock.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>clock</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_001_476"> </a>NAME</h4><blockquote>clock - report CPU time used</blockquote><h4><a name = "tag_000_001_477"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="time.h.html">time.h</a>>clock_t clock(void);</code></pre></blockquote><h4><a name = "tag_000_001_478"> </a>DESCRIPTION</h4><blockquote>The<i>clock()</i>function returns the implementation's best approximation to theprocessor time used by the process since the beginning of animplementation-dependent time related only to the process invocation.</blockquote><h4><a name = "tag_000_001_479"> </a>RETURN VALUE</h4><blockquote>To determine the time in seconds, the value returned by<i>clock()</i>should be divided by the value of the macro CLOCKS_PER_SEC.CLOCKS_PER_SEC is defined to be one million in<i><a href="time.h.html"><time.h></a></i>.If the processor time used is not available or its value cannotbe represented, the function returns the value (<b>clock_t</b>)-1.</blockquote><h4><a name = "tag_000_001_480"> </a>ERRORS</h4><blockquote>No errors are defined.</blockquote><h4><a name = "tag_000_001_481"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_482"> </a>APPLICATION USAGE</h4><blockquote>In order to measure the time spent in a program,<i>clock()</i>should be called at the start of the program and itsreturn value subtracted from the value returned by subsequentcalls.The value returned by<i>clock()</i>is defined for compatibility across systems that have clockswith different resolutions.The resolution on any particular system need not be tomicrosecond accuracy.<p>The value returned by<i>clock()</i>may wrap around on some systems. For example, on a machine with 32-bitvalues for<b>clock_t</b>it will wrap after 2147 seconds or 36 minutes.</blockquote><h4><a name = "tag_000_001_483"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_001_484"> </a>SEE ALSO</h4><blockquote><i><a href="asctime.html">asctime()</a></i>,<i><a href="ctime.html">ctime()</a></i>,<i><a href="difftime.html">difftime()</a></i>,<i><a href="gmtime.html">gmtime()</a></i>,<i><a href="localtime.html">localtime()</a></i>,<i><a href="mktime.html">mktime()</a></i>,<i><a href="strftime.html">strftime()</a></i>,<i><a href="strptime.html">strptime()</a></i>,<i><a href="time.html">time()</a></i>,<i><a href="utime.html">utime()</a></i>,<i><a href="time.h.html"><time.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -