BUG: DTIME() and ETIME() Return Zero Under Windows 95

ID: Q147754

4.00    | 4.00
WINDOWS | WINDOWS NT kbprg kbbuglist

The information in this article applies to:

SYMPTOMS

The DTIME() and ETIME() functions incorrectly return zero for program execution and elapsed CPU time under Windows 95.

CAUSE

Windows 95 does not support the underlying Win32 API function calls accessed by these functions. This does not apply to Windows NT 3.51.

RESOLUTION

Use the TIMEF() function to profile CPU timings under Windows 95.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following program under Windows NT 3.51 produces the correct elapsed time results for DTIME() and ETIME(). The same code under Windows 95 causes zero to be returned as the result, while TIMEF() works correctly under both operating systems.

Sample Code

C Compile options need: none

      USE PORTLIB
      REAL(4) DT0, DT1, ET0, ET1, TIMER(2)
      REAL(8) ELAPSED_TIME

      WRITE(*,*) 'Elapsed execution times...'
      WRITE(*,*)

      DT0 = DTIME(TIMER)
      CALL SPEND_TIME
      DT1 = DTIME(TIMER)

      WRITE(*, '(A14,F6.3,A8)') 'Using DTIME: ', DT1-DT0, 'seconds'

      ET0 = ETIME(TIMER)
      CALL SPEND_TIME
      ET1 = ETIME(TIMER)

      WRITE(*, '(A14,F6.3,A8)') 'Using ETIME: ', ET1-ET0, 'seconds'

C Use the following code as a workaround under Windows 95

      ELAPSED_TIME = TIMEF()
      CALL SPEND_TIME
      ELAPSED_TIME = TIMEF()

      WRITE(*, '(A14,F6.3,A8)') 'Using TIMEF: ', ELAPSED_TIME, 'seconds'

      END

      SUBROUTINE SPEND_TIME
      INTEGER I, J
      DO I = 1, 1000000
      J = J**2
      END DO
      END SUBROUTINE

REFERENCES

Microsoft FORTRAN PowerStation 32 4.0 Books Online Readme.

Additional reference words: 4.00 KBCategory: kbprg kbbuglist KBSubcategory: FORTLngIss

Keywords          : kbFortranPS kbLangFortran kbbuglist
Version           : 4.00    | 4.00
Platform          : NT WINDOWS

Last Reviewed: March 3, 1996