]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/fortran/doc/gfortran/intrinsic-procedures/systemclock.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / fortran / doc / gfortran / intrinsic-procedures / systemclock.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: SYSTEM_CLOCK, time, clock ticks, clock ticks
7
8 .. _system_clock:
9
10 SYSTEM_CLOCK --- Time function
11 ******************************
12
13 .. function:: SYSTEM_CLOCK(COUNT, COUNT_RATE, COUNT_MAX)
14
15 Determines the :samp:`{COUNT}` of a processor clock since an unspecified
16 time in the past modulo :samp:`{COUNT_MAX}`, :samp:`{COUNT_RATE}` determines
17 the number of clock ticks per second. If the platform supports a
18 monotonic clock, that clock is used and can, depending on the platform
19 clock implementation, provide up to nanosecond resolution. If a
20 monotonic clock is not available, the implementation falls back to a
21 realtime clock.
22
23 :param COUNT:
24 (Optional) shall be a scalar of type
25 ``INTEGER`` with ``INTENT(OUT)``.
26
27 :param COUNT_RATE:
28 (Optional) shall be a scalar of type
29 ``INTEGER`` or ``REAL``, with ``INTENT(OUT)``.
30
31 :param COUNT_MAX:
32 (Optional) shall be a scalar of type
33 ``INTEGER`` with ``INTENT(OUT)``.
34
35 Standard:
36 Fortran 90 and later
37
38 Class:
39 Subroutine
40
41 Syntax:
42 .. code-block:: fortran
43
44 CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])
45
46 Example:
47 .. code-block:: fortran
48
49 PROGRAM test_system_clock
50 INTEGER :: count, count_rate, count_max
51 CALL SYSTEM_CLOCK(count, count_rate, count_max)
52 WRITE(*,*) count, count_rate, count_max
53 END PROGRAM
54
55 See also:
56 :ref:`DATE_AND_TIME`,
57 :ref:`CPU_TIME`