Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

3 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>Timefns (The Red Hat newlib C Library)</title>
  7. <meta name="description" content="Timefns (The Red Hat newlib C Library)">
  8. <meta name="keywords" content="Timefns (The Red Hat newlib C Library)">
  9. <meta name="resource-type" content="document">
  10. <meta name="distribution" content="global">
  11. <meta name="Generator" content="makeinfo">
  12. <link href="index.html#Top" rel="start" title="Top">
  13. <link href="Document-Index.html#Document-Index" rel="index" title="Document Index">
  14. <link href="Document-Index.html#SEC_Contents" rel="contents" title="Table of Contents">
  15. <link href="index.html#Top" rel="up" title="Top">
  16. <link href="asctime.html#asctime" rel="next" title="asctime">
  17. <link href="signal.html#signal" rel="prev" title="signal">
  18. <style type="text/css">
  19. <!--
  20. a.summary-letter {text-decoration: none}
  21. blockquote.indentedblock {margin-right: 0em}
  22. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  23. blockquote.smallquotation {font-size: smaller}
  24. div.display {margin-left: 3.2em}
  25. div.example {margin-left: 3.2em}
  26. div.lisp {margin-left: 3.2em}
  27. div.smalldisplay {margin-left: 3.2em}
  28. div.smallexample {margin-left: 3.2em}
  29. div.smalllisp {margin-left: 3.2em}
  30. kbd {font-style: oblique}
  31. pre.display {font-family: inherit}
  32. pre.format {font-family: inherit}
  33. pre.menu-comment {font-family: serif}
  34. pre.menu-preformatted {font-family: serif}
  35. pre.smalldisplay {font-family: inherit; font-size: smaller}
  36. pre.smallexample {font-size: smaller}
  37. pre.smallformat {font-family: inherit; font-size: smaller}
  38. pre.smalllisp {font-size: smaller}
  39. span.nolinebreak {white-space: nowrap}
  40. span.roman {font-family: initial; font-weight: normal}
  41. span.sansserif {font-family: sans-serif; font-weight: normal}
  42. ul.no-bullet {list-style: none}
  43. -->
  44. </style>
  45. </head>
  46. <body lang="en">
  47. <a name="Timefns"></a>
  48. <div class="header">
  49. <p>
  50. Next: <a href="Locale.html#Locale" accesskey="n" rel="next">Locale</a>, Previous: <a href="Signals.html#Signals" accesskey="p" rel="prev">Signals</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  51. </div>
  52. <hr>
  53. <a name="Time-Functions-_0028time_002eh_0029"></a>
  54. <h2 class="chapter">8 Time Functions (<samp>time.h</samp>)</h2>
  55. <p>This chapter groups functions used either for reporting on time
  56. (elapsed, current, or compute time) or to perform calculations based
  57. on time.
  58. </p>
  59. <p>The header file <samp>time.h</samp> defines three types. <code>clock_t</code> and
  60. <code>time_t</code> are both used for representations of time particularly
  61. suitable for arithmetic. (In this implementation, quantities of type
  62. <code>clock_t</code> have the highest resolution possible on your machine,
  63. and quantities of type <code>time_t</code> resolve to seconds.) <code>size_t</code>
  64. is also defined if necessary for quantities representing sizes.
  65. </p>
  66. <p><samp>time.h</samp> also defines the structure <code>tm</code> for the traditional
  67. representation of Gregorian calendar time as a series of numbers, with
  68. the following fields:
  69. </p>
  70. <dl compact="compact">
  71. <dt><code>tm_sec</code></dt>
  72. <dd><p>Seconds, between 0 and 60 inclusive (60 allows for leap seconds).
  73. </p>
  74. </dd>
  75. <dt><code>tm_min</code></dt>
  76. <dd><p>Minutes, between 0 and 59 inclusive.
  77. </p>
  78. </dd>
  79. <dt><code>tm_hour</code></dt>
  80. <dd><p>Hours, between 0 and 23 inclusive.
  81. </p>
  82. </dd>
  83. <dt><code>tm_mday</code></dt>
  84. <dd><p>Day of the month, between 1 and 31 inclusive.
  85. </p>
  86. </dd>
  87. <dt><code>tm_mon</code></dt>
  88. <dd><p>Month, between 0 (January) and 11 (December).
  89. </p>
  90. </dd>
  91. <dt><code>tm_year</code></dt>
  92. <dd><p>Year (since 1900), can be negative for earlier years.
  93. </p>
  94. </dd>
  95. <dt><code>tm_wday</code></dt>
  96. <dd><p>Day of week, between 0 (Sunday) and 6 (Saturday).
  97. </p>
  98. </dd>
  99. <dt><code>tm_yday</code></dt>
  100. <dd><p>Number of days elapsed since last January 1, between 0 and 365 inclusive.
  101. </p>
  102. </dd>
  103. <dt><code>tm_isdst</code></dt>
  104. <dd><p>Daylight Savings Time flag: positive means DST in effect, zero means DST
  105. not in effect, negative means no information about DST is available.
  106. Although for mktime(), negative means that it should decide if DST is in
  107. effect or not.
  108. </p></dd>
  109. </dl>
  110. <table class="menu" border="0" cellspacing="0">
  111. <tr><td align="left" valign="top">&bull; <a href="asctime.html#asctime" accesskey="1">asctime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Format time as string
  112. </td></tr>
  113. <tr><td align="left" valign="top">&bull; <a href="clock.html#clock" accesskey="2">clock</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Cumulative processor time
  114. </td></tr>
  115. <tr><td align="left" valign="top">&bull; <a href="ctime.html#ctime" accesskey="3">ctime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to local and format as string
  116. </td></tr>
  117. <tr><td align="left" valign="top">&bull; <a href="difftime.html#difftime" accesskey="4">difftime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Subtract two times
  118. </td></tr>
  119. <tr><td align="left" valign="top">&bull; <a href="gmtime.html#gmtime" accesskey="5">gmtime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to UTC (GMT) traditional representation
  120. </td></tr>
  121. <tr><td align="left" valign="top">&bull; <a href="localtime.html#localtime" accesskey="6">localtime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to local representation
  122. </td></tr>
  123. <tr><td align="left" valign="top">&bull; <a href="mktime.html#mktime" accesskey="7">mktime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert time to arithmetic representation
  124. </td></tr>
  125. <tr><td align="left" valign="top">&bull; <a href="strftime.html#strftime" accesskey="8">strftime</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Convert date and time to a user-formatted string
  126. </td></tr>
  127. <tr><td align="left" valign="top">&bull; <a href="time.html#time" accesskey="9">time</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Get current calendar time (as single number)
  128. </td></tr>
  129. <tr><td align="left" valign="top">&bull; <a href="_005f_005ftz_005flock.html#g_t_005f_005ftz_005flock">__tz_lock</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Lock time zone global variables
  130. </td></tr>
  131. <tr><td align="left" valign="top">&bull; <a href="tzset.html#tzset">tzset</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Set timezone info
  132. </td></tr>
  133. </table>
  134. <hr>
  135. <div class="header">
  136. <p>
  137. Next: <a href="Locale.html#Locale" accesskey="n" rel="next">Locale</a>, Previous: <a href="Signals.html#Signals" accesskey="p" rel="prev">Signals</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<a href="Document-Index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Document-Index.html#Document-Index" title="Index" rel="index">Index</a>]</p>
  138. </div>
  139. </body>
  140. </html>