XL Fortran for AIX 8.1

Language Reference


SYSTEM_CLOCK(COUNT, COUNT_RATE, COUNT_MAX)

Returns integer data from a real-time clock.

COUNT (optional)
is an INTENT(OUT) argument that must be scalar and of type default integer. The initial value of COUNT depends on the current value of the processor clock in a range from 0 to COUNT_MAX. COUNT increments by one for each clock count until it reaches the value of COUNT_MAX. At the next clock count after COUNT_MAX, the value of COUNT resets to zero.

COUNT_RATE (optional)
is an INTENT(OUT) argument that must be scalar and of type default integer. When using the default centisecond resolution, COUNT_RATE refers to the number of processor clock counts per second or to zero if there is no clock.

If you specify a microsecond resolution using -qsclk=micro, the value of COUNT_RATE is 1 000 000 clock counts per second.

COUNT_MAX (optional)
is an INTENT(OUT) argument that must be scalar and of type default integer. When using the default centisecond resolution, COUNT_MAX is the maximum number of clock counts for a given processor clock.

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 8 639 999 999 clock counts, or about 24 hours.

Class

Subroutine

+-------------------------------IBM Extension--------------------------------+

Examples

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

+----------------------------End of IBM Extension----------------------------+

Related Information

See the -qsclk compiler option in the User's Guide for more information on specifying system clock resolution.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]