BUG: DATE_AND_TIME Returns Zero for the Milliseconds Value

ID: Q147755

4.00    | 4.00
WINDOWS | WINDOWS NT kbprg kbbuglist

The information in this article applies to:

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
Keywords          : kbFortranPS kbLangFortran kbbuglist
Version           : 4.00    | 4.00
Platform          : NT WINDOWS

Last Reviewed: March 3, 1996