SYSTEM_005fCLOCK.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1999-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>The GNU Fortran Compiler: SYSTEM_CLOCK</title>
  20. <meta name="description" content="The GNU Fortran Compiler: SYSTEM_CLOCK">
  21. <meta name="keywords" content="The GNU Fortran Compiler: SYSTEM_CLOCK">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Intrinsic-Procedures.html#Intrinsic-Procedures" rel="up" title="Intrinsic Procedures">
  30. <link href="TAN.html#TAN" rel="next" title="TAN">
  31. <link href="SYSTEM.html#SYSTEM" rel="prev" title="SYSTEM">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="SYSTEM_005fCLOCK"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="TAN.html#TAN" accesskey="n" rel="next">TAN</a>, Previous: <a href="SYSTEM.html#SYSTEM" accesskey="p" rel="prev">SYSTEM</a>, Up: <a href="Intrinsic-Procedures.html#Intrinsic-Procedures" accesskey="u" rel="up">Intrinsic Procedures</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  66. </div>
  67. <hr>
  68. <a name="SYSTEM_005fCLOCK-_002d_002d_002d-Time-function"></a>
  69. <h3 class="section">9.262 <code>SYSTEM_CLOCK</code> &mdash; Time function</h3>
  70. <a name="index-SYSTEM_005fCLOCK"></a>
  71. <a name="index-time_002c-clock-ticks-2"></a>
  72. <a name="index-clock-ticks-2"></a>
  73. <dl compact="compact">
  74. <dt><em>Description</em>:</dt>
  75. <dd><p>Determines the <var>COUNT</var> of a processor clock since an unspecified
  76. time in the past modulo <var>COUNT_MAX</var>, <var>COUNT_RATE</var> determines
  77. the number of clock ticks per second. If the platform supports a
  78. monotonic clock, that clock is used and can, depending on the platform
  79. clock implementation, provide up to nanosecond resolution. If a
  80. monotonic clock is not available, the implementation falls back to a
  81. realtime clock.
  82. </p>
  83. <p><var>COUNT_RATE</var> is system dependent and can vary depending on the kind of
  84. the arguments. For <var>kind=4</var> arguments (and smaller integer kinds),
  85. <var>COUNT</var> represents milliseconds, while for <var>kind=8</var> arguments (and
  86. larger integer kinds), <var>COUNT</var> typically represents micro- or
  87. nanoseconds depending on resolution of the underlying platform clock.
  88. <var>COUNT_MAX</var> usually equals <code>HUGE(COUNT_MAX)</code>. Note that the
  89. millisecond resolution of the <var>kind=4</var> version implies that the
  90. <var>COUNT</var> will wrap around in roughly 25 days. In order to avoid issues
  91. with the wrap around and for more precise timing, please use the
  92. <var>kind=8</var> version.
  93. </p>
  94. <p>If there is no clock, or querying the clock fails, <var>COUNT</var> is set
  95. to <code>-HUGE(COUNT)</code>, and <var>COUNT_RATE</var> and <var>COUNT_MAX</var> are
  96. set to zero.
  97. </p>
  98. <p>When running on a platform using the GNU C library (glibc) version
  99. 2.16 or older, or a derivative thereof, the high resolution monotonic
  100. clock is available only when linking with the <var>rt</var> library. This
  101. can be done explicitly by adding the <code>-lrt</code> flag when linking the
  102. application, but is also done implicitly when using OpenMP.
  103. </p>
  104. <p>On the Windows platform, the version with <var>kind=4</var> arguments uses
  105. the <code>GetTickCount</code> function, whereas the <var>kind=8</var> version
  106. uses <code>QueryPerformanceCounter</code> and
  107. <code>QueryPerformanceCounterFrequency</code>. For more information, and
  108. potential caveats, please see the platform documentation.
  109. </p>
  110. </dd>
  111. <dt><em>Standard</em>:</dt>
  112. <dd><p>Fortran 95 and later
  113. </p>
  114. </dd>
  115. <dt><em>Class</em>:</dt>
  116. <dd><p>Subroutine
  117. </p>
  118. </dd>
  119. <dt><em>Syntax</em>:</dt>
  120. <dd><p><code>CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])</code>
  121. </p>
  122. </dd>
  123. <dt><em>Arguments</em>:</dt>
  124. <dd><table>
  125. <tr><td width="15%"><var>COUNT</var></td><td width="70%">(Optional) shall be a scalar of type
  126. <code>INTEGER</code> with <code>INTENT(OUT)</code>.</td></tr>
  127. <tr><td width="15%"><var>COUNT_RATE</var></td><td width="70%">(Optional) shall be a scalar of type
  128. <code>INTEGER</code> or <code>REAL</code>, with <code>INTENT(OUT)</code>.</td></tr>
  129. <tr><td width="15%"><var>COUNT_MAX</var></td><td width="70%">(Optional) shall be a scalar of type
  130. <code>INTEGER</code> with <code>INTENT(OUT)</code>.</td></tr>
  131. </table>
  132. </dd>
  133. <dt><em>Example</em>:</dt>
  134. <dd><div class="smallexample">
  135. <pre class="smallexample">PROGRAM test_system_clock
  136. INTEGER :: count, count_rate, count_max
  137. CALL SYSTEM_CLOCK(count, count_rate, count_max)
  138. WRITE(*,*) count, count_rate, count_max
  139. END PROGRAM
  140. </pre></div>
  141. </dd>
  142. <dt><em>See also</em>:</dt>
  143. <dd><p><a href="DATE_005fAND_005fTIME.html#DATE_005fAND_005fTIME">DATE_AND_TIME</a>, <a href="CPU_005fTIME.html#CPU_005fTIME">CPU_TIME</a>
  144. </p></dd>
  145. </dl>
  146. <hr>
  147. <div class="header">
  148. <p>
  149. Next: <a href="TAN.html#TAN" accesskey="n" rel="next">TAN</a>, Previous: <a href="SYSTEM.html#SYSTEM" accesskey="p" rel="prev">SYSTEM</a>, Up: <a href="Intrinsic-Procedures.html#Intrinsic-Procedures" accesskey="u" rel="up">Intrinsic Procedures</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  150. </div>
  151. </body>
  152. </html>