DTIME — Execution time subroutine (or function)#

DTIME(VALUES, TIME)#

DTIME(VALUES, TIME) initially returns the number of seconds of runtime since the start of the process’s execution in TIME. VALUES returns the user and system components of this time in VALUES(1) and VALUES(2) respectively. TIME is equal to VALUES(1) + VALUES(2).

Parameters:
  • VALUES – The type shall be REAL(4), DIMENSION(2).

  • TIME – The type shall be REAL(4).

Returns:

Elapsed time in seconds since the last invocation or since the start of program execution if not called before.

Standard:

GNU extension

Class:

Subroutine, function

Syntax:
CALL DTIME(VALUES, TIME).
TIME = DTIME(VALUES), (not recommended).
Example:
program test_dtime
    integer(8) :: i, j
    real, dimension(2) :: tarray
    real :: result
    call dtime(tarray, result)
    print *, result
    print *, tarray(1)
    print *, tarray(2)
    do i=1,100000000    ! Just a delay
        j = i * i - i
    end do
    call dtime(tarray, result)
    print *, result
    print *, tarray(1)
    print *, tarray(2)
end program test_dtime
See also:

CPU_TIME — CPU elapsed time in seconds