Fortran Wiki
system_clock (Rev #3, changes)

Showing changes from revision #2 to #3: Added | Removed | Changed

Description

Determines the SYSTEM_CLOCK(f95)count lets you measure durations of time with the precision of the smallest time increment generally available on a system by returning processor-dependent values based on the current value of the processor clock. The of milliseconds of wall clock time since the Epoch (00:00:00 UTC, January 1, 1970) modulo clock value is incremented by one for each clock count until the value count_max , is reached and is then reset to zero at the next count.clock therefore is a modulo value that lies in the range 0 to count_max. count_rate determines and the number of clock ticks per second.count_rate and count_max are assumed constant and (even specific though to CPU rates can vary on a single platform). gfortran count_rate . reports the number of clock ticks per second, allowingclock values to be translated from clock clicks to seconds.

If there is no clock, count is set to -huge(count), and count_rate and count_max are set to zero zero.

SYSTEM_CLOCK(f95) is typically used to measure short time intervals (system clocks may be 24-hour clocks or measure processor clock ticks since boot, for example). It is most often used for measuring or tracking the time spent in code blocks in lieu of using profiling tools.

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 defaultinteger with intent(out).
  • count_rate - (Optional) shall be a scalar of type defaultinteger or real with intent(out).
  • count_max - (Optional) shall be a scalar of type defaultinteger 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

category: intrinsics