### 8.239 `SYSTEM_CLOCK` — Time function

Description:
  Determines the COUNT of a processor clock since an unspecified time in the past modulo COUNT_MAX, COUNT_RATE determines the number of clock ticks per second. If the platform supports a high resolution monotonic clock, that clock is used and can provide up to nanosecond resolution. If a high resolution monotonic clock is not available, the implementation falls back to a potentially lower resolution realtime clock.

  COUNT_RATE is system dependent and can vary depending on the kind of the arguments. For kind=4 arguments, COUNT usually represents milliseconds, while for kind=8 arguments, COUNT typically represents micro- or nanoseconds. COUNT_MAX usually equals `HUGE(COUNT_MAX)`.

  If there is no clock, COUNT is set to `-HUGE(COUNT)`, and COUNT_RATE and COUNT_MAX are set to zero.

  When running on a platform using the GNU C library (glibc), or a derivative thereof, the high resolution monotonic clock is available only when linking with the rt library. This can be done explicitly by adding the `-lrt` flag when linking the application, but is also done implicitly when using OpenMP.

Standard:
  Fortran 95 and later
Class:
  Subroutine
Syntax:
  `CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])`
Arguments:

  COUNT | (Optional) shall be a scalar of type `INTEGER` with `INTENT(OUT)`.
  COUNT_RATE | (Optional) shall be a scalar of type `INTEGER` with `INTENT(OUT)`.
  COUNT_MAX | (Optional) shall be a scalar of type `INTEGER` with `INTENT(OUT)`.

Example:

                PROGRAM test_system_clock
                  INTEGER :: count, count_rate, count_max
                  CALL SYSTEM_CLOCK(count, count_rate, count_max)
                  WRITE(*,*) count, count_rate, count_max
                END PROGRAM

See also:
  DATE_AND_TIME, CPU_TIME