BUG: DATE_AND_TIME Returns Zero for the Milliseconds Value

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

SYMPTOMS

When you use the VALUES array parameter of the DATE_AND_TIME subroutine, zero is returned from the system clock to the milliseconds array element.

RESOLUTION

Use the TIME parameter to the DATE_AND_TIME subroutine, or use the GETTIM() subroutine, which is accurate up to one-hundredths of a second.

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

Sample Code to Illustrate Problem and Workarounds

C Compile options needed: none

      USE MSFLIB
      INTEGER(4) CURTIME(8)
C      CHARACTER*10 TIME_STR               ! Uncomment for Workaround #1
C INTEGER(2) THOUR, TMIN, TSEC, THUN ! Uncomment for Workaround #2

      CALL DATE_AND_TIME(VALUES=CURTIME)   ! Returns zero milliseconds.
      WRITE(*,*) 'Using DATE_AND_TIME().'
      WRITE(*, 100) CURTIME(5), CURTIME(6), CURTIME(7), CURTIME(8)
      WRITE(*,*)

C Uncomment the following two lines for Workaround #1

C CALL DATE_AND_TIME(TIME=TIME_STR) C WRITE(*,*) 'The current time is: ', TIME_STR

C Uncomment the following three lines for Workaround #2

C WRITE(*,*) ; WRITE(*,*) 'Using GETTIM().' C CALL GETTIM(THOUR, TMIN, TSEC, THUN) C WRITE(*, 100) THOUR, TMIN, TSEC, THUN*10

100 FORMAT(' The current time is: ', I2.2, ':', I2.2, ':',

     + I2.2, '.', I3.3)

      END


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.