Showing results for 
Search instead for 
Did you mean: 

measure elapsed time with IFLPORT timef


I use the function timef (module IFLPORT) to measure the elapsed time of my executable. I called it at the beginning and again at the end of the computations. In most cases the elapsed time is correct. However, sometimes I get a negativ elapsed time.

Any ideas what went wrong?



0 Kudos
2 Replies
Valued Contributor II

I will hazard a guess that

I will hazard a guess that the variable you use for timef is a default real kind ( real(4) ) rather than real(8)....

0 Kudos
Black Belt

The kind of behavior

The kind of behavior described in #1 happens if, as Andrew surmised, the value returned by the nonstandard extension TIMEF() is assigned to a single-precision real, AND the compiler is not told that TIMEF is of type DOUBLE PRECISION.

Either add USE IFPORT to your program unit that calls TIMEF(), or declare TIMEF as DOUBLE PRECISION in that unit.

0 Kudos