SYSTEM_CLOCK
— Time functionCOUNT_RATE is system dependent and can vary depending on the kind of
the arguments. For kind=4 arguments (and smaller integer kinds),
COUNT represents milliseconds, while for kind=8 arguments (and
larger integer kinds), COUNT typically represents micro- or
nanoseconds depending on resolution of the underlying platform clock.
COUNT_MAX usually equals HUGE(COUNT_MAX)
. Note that the
millisecond resolution of the kind=4 version implies that the
COUNT will wrap around in roughly 25 days. In order to avoid issues
with the wrap around and for more precise timing, please use the
kind=8 version.
If there is no clock, or querying the clock fails, 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) version
2.16 or older, 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.
On the Windows platform, the version with kind=4 arguments uses
the GetTickCount
function, whereas the kind=8 version
uses QueryPerformanceCounter
and
QueryPerformanceCounterFrequency
. For more information, and
potential caveats, please see the platform documentation.
CALL SYSTEM_CLOCK([COUNT, COUNT_RATE, COUNT_MAX])
COUNT | (Optional) shall be a scalar of type
INTEGER with INTENT(OUT) .
|
COUNT_RATE | (Optional) shall be a scalar of type
INTEGER or REAL , with INTENT(OUT) .
|
COUNT_MAX | (Optional) shall be a scalar of type
INTEGER with INTENT(OUT) .
|
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