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
#ifdef __INTEL_COMPILER
use IFPORT
#endif
implicit none
integer :: rand_seed
real(8) :: dh
#ifndef __INTEL_COMPILER
real :: rand
#endif
rand_seed = ABS(TIME())
call srand(rand_seed)
dh=dx(is)
rad(1) = rad(1) + dh*(2.0d0rand()-1.0d0)
xc(1)=xLength/2.0d0 + dh
(2.0d0rand()-1.0d0)
yc(1)=yLength/2.0d0 + dh
(2.0d0rand()-1.0d0)
zc(1)=zLength/2.0d0 + dh
(2.0d0*rand()-1.0d0)

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,
Mat