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

Last reviewed: February 29, 1996
Article ID: Q147754
The information in this article applies to:
  • Microsoft Fortran PowerStation for Windows 95 and Windows NT, version 4.0

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 29, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.