Problem with standart TIME fortran function

Hi everyone,

I am new to the PGI compilers. I am having trouble compiling a code (here attached). I get the following error:

PGF90-S-0038-Symbol, time, has not been explicitly declared (main.f90)
0 inform, 0 warnings, 1 severes, 0 fatal for myfun

It seems to me that there is a problem with the standard TIME function in fortran, which is not recognized. How can I fix this issue?

thanks in ad

subroutine myfun()
use module_1
use module_2
implicit none
integer :: rand_seed
real(8) :: dh
real :: rand
rand_seed = ABS(TIME())
call srand(rand_seed)
rad(1) = rad(1) + dh*(2.0d0rand()-1.0d0)
xc(1)=xLength/2.0d0 + dh
yc(1)=yLength/2.0d0 + dh
zc(1)=zLength/2.0d0 + dh

end subroutine myfun

Hi Marcres,

“time”, as well as “rand” and “srand”, are not standard Fortran, rather these are external C functions. Hence, you’ll need to declare “time” (similar how you declare “rand”), in order to call it.

Though, I would suggest you switch to use the Fortran equivalent functions “CPU_TIME”, “RANDOM_NUMBER” and “RANDOM_SEED” to be standard compliant.

Hope this helps,