To: J3 J3/21-117r2 From: Richard Bleikamp & JoR & John Reid Subject: system_clock() with normative changes Date: 2021-February-27 Reference: 21-104r2 This "r2" paper adds edits to the Introduction and Compatibility sections of 21-007, which include a new feature (multiple clocks), and adds an edit to make it clear that which particular clock is used by an invocation of system_clock is determined by the kind type parameters of the integer arguments passed to system_clock, and processor-dependent if no integer arguments are present. This paper is an alternative to 21-104r1. 21-104r1 introduces a NOTE that describes best practice for calling system_clock(). This paper adds edits that prohibit some very poor practices, and adds further emphasis about how the kind of integers passed to system_clock should always be consistant across all calls to system_clock(), if the values returned are used to compute elasped time. EDITS: against 21-007 [xiii:2] In the paragraph titled "Intrinsic procedures and modules:" add, after the descriptions of SPLIT and TOKENIZE (from 21-115r2), "The intrinsic subroutine SYSTEM_CLOCK now supports more than one system clock for an image." [27:22] Replace "A standard-conforming Fortran 2018 program " with "A standard-conforming Fortran 2018 program that does not use any feature identified in this subclause as being no longer permitted " [27:24] replace "feature" with "features" [27:28+] add two new bullet items "Fortran 2018 allowed integer arguments to the SYSTEM_CLOCK intrinsic subroutine to be of any kind type parameter. This document requires integer arguments to SYSTEM_CLOCK to have a decimal exponent range at least as large as a default integer, and requires that all integer arguments to a particular SYSTEM_CLOCK invocation have the same kind type parameter. This document permits the SYSTEM_CLOCK intrinsic subroutine to use two or more system clocks, with different characteristics, based on the kind type parameters of the integer arguments passed to SYSTEM_CLOCK. A program that invokes SYSTEM_CLOCK solely with integer arguments with the same kind type parameter in all invocations will have the same interpretation under this document as in Fortran 2018. All other programs that invoke SYSTEM_CLOCK may have a different interpretation under this document." [437:5] replace "shall be an integer scalar" with "shall be an integer scalar with a decimal exponent range equal to or greater than RANGE(0)." [437:10] After "shall be an integer or real scalar." add the sentence, "If COUNT_RATE is of type integer, it shall have a decimal exponent range equal to or greater than RANGE(0)." [437:13] replace "shall be an integer scalar" with "shall be an integer scalar with a decimal exponent range equal to or greater than RANGE(0)." [437:14+] add this paragraph "In an invocation of SYSTEM_CLOCK, all arguments of type integer shall have the same kind type parameter." [437:15] replace "a single clock" with "one or more clocks of its own" [437:16] Add, after the period, "It is processor-dependent whether SYSTEM_CLOCK uses the integer kind type parameter of the COUNT or COUNT_MAX arguments to select among available system clocks, each with its own counts per second and maximum value." When an image has more than one system clock, different invocations of SYSTEM_CLOCK should all use the same kind type parameter for all integer arguments, to ensure any timing calculations based on the COUNT, COUNT_RATE, and COUNT_MAX returned from those invocations use the same clock, and its corresponding clock rate and maximum count. When only the COUNT_RATE argument is present in an invocation of SYSTEM_CLOCK, and it is of type real, which system clock is used is processor-dependent." [437,21+], add this NOTE NOTE "Many systems have a clock that is too fast to be effectively supported with default integers. Therefore, it is recommended that all invocations of SYSTEM_CLOCK use integer arguments with a decimal exponent range of at least 18. Using SYSTEM_CLOCK in this manner may minimize how often the returned COUNT "rolls over" and the processor will typically select the most accurate clock available. [541:37+] add several new bulleted items (processor dependendcies) "whether an image has zero, one, or more system clocks that can be queried by the intrinsic subroutine SYSTEM_CLOCK (16.9.xxx); which system clock the intrinsic subroutine SYSTEM_CLOCK queries when more than one system clock is available in an image (16.9.xxx);" ---- end of edits