system_clock

Date:

02-06-2023

NAME

SYSTEM_CLOCK - Returns numeric data from a real-time clock

SYNOPSIS

CALL SYSTEM_CLOCK ([[COUNT=]count][,[COUNT_RATE=]count_rate]
                   [,[COUNT_MAX=count_max])
INTEGER :: count, count_max
INTEGER|REAL :: count_rate

STANDARDS

Fortran 2008

DESCRIPTION

The SYSTEM_CLOCK intrinsic subroutine returns information gathered from the real-time clock. SYSTEM_CLOCK accepts the following arguments:

count

Must be scalar and type integer.

  • If count is present, it is set to a machine-specific value based on the current value of the machine’s clock.

  • If there is no clock, it is set to -HUGE(0).

  • If count is type integer (KIND=8), the machine-specific value is incremented by one for each clock count until the value count_max is reached; it is reset to 0 at the next count.

  • If count is type integer (KIND=4), the machine-specific value is incremented by one for every 100 clock counts until the value count_max is reached; it is reset to 0 at the next count.

  • If there is a clock, it lies in the range 0 to count_max.

count_rate

Must be scalar and type integer or real.

  • If count_rate is present, it is set to the number of clock counts per second.

  • If there is no clock, it is set to 0.

  • If count_rate is type integer (KIND=4) or real (KIND=4), the rate is scaled down by a factor of 100.

count_max

Must be scalar and type integer.

  • If count_max is present, it is set to the maximum value that count can have.

  • If there is no clock, it is set to 0.

Because the values of count reach the count_max in a very short time for KIND=4 (32-bit) types, the value is scaled down by a factor of 100. The KIND=4 count_rate is scaled by the same factor. Because of this scaling, care must be taken to ensure that the kind types for count and count_rate are the same. Since the Fortran 2008 Standard has no restriction concerning kind types for these arguments, the scaling can be disabled by using the ftn command line -ds option. See the ftn(1) man page for details on using this argument.

The name of this intrinsic cannot be passed as an argument.

SEE ALSO

ftn(1)

sysclock(3f)

gettimeofday(2)