Returns integer data from a real-time clock.
Subroutine
If you specify a microsecond resolution using -qsclk=micro, the value of COUNT_RATE is 1 000 000 clock counts per second.
If you specify a microsecond resolution using -qsclk=micro and a default of INTEGER(4), the value of COUNT_MAX is 1 799 999 999 clock counts, or about 30 minutes.
If you specify a microsecond resolution using -qsclk=micro and a default of INTEGER(8), the value of COUNT_MAX is 86 399 999 999 clock counts, or about 24 hours.
In the following example, the clock is a 24-hour clock. After the call to SYSTEM_CLOCK, the COUNT contains the day time expressed in clock ticks per second. The number of ticks per second is available in the COUNT_RATE. The COUNT_RATE value is implementation dependent.
INTEGER, DIMENSION(8) :: IV TIME_SYNC: DO CALL DATE_AND_TIME(VALUES=IV) IHR = IV(5) IMIN = IV(6) ISEC = IV(7) CALL SYSTEM_CLOCK(COUNT=IC, COUNT_RATE=IR, COUNT_MAX=IM) CALL DATE_AND_TIME(VALUES=IV) IF ((IHR == IV(5)) .AND. (IMIN == IV(6)) .AND. & (ISEC == IV(7))) EXIT TIME_SYNC END DO TIME_SYNC IDAY_SEC = 3600*IHR + IMIN*60 + ISEC IDAY_TICKS = IDAY_SEC * IR IF (IDAY_TICKS /= IC) THEN STOP 'clock error' ENDIF END
See the -qsclk compiler option in the XL Fortran Compiler Reference for more information on specifying system clock resolution.