SECNDS can be used as an intrinsic function or as a portability function. It is an intrinsic procedure unless you specify USE IFPORT.
Elemental Intrinsic Function (Specific): Provides the system time of day, or elapsed time, as a floating-point value in seconds.
This is a specific function that has no generic function associated with it. It must not be passed as an actual argument.
It is not a pure function, so it cannot be referenced inside a FORALL construct.
Syntax
result = SECNDS (x)
x
(Input) Must be of type REAL(4).
Results
The result type is the same as x. The result value is the time in seconds since midnight - x. (The function also produces correct results for time intervals that span midnight.)
The value of SECNDS is accurate to 0.01 second, which is the resolution of the system clock.
The 24 bits of precision provide accuracy to the resolution of the system clock for about one day. However, loss of significance can occur if you attempt to compute very small elapsed times late in the day.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS LIB
See Also
DATE_AND_TIME, RTC, SYSTEM_CLOCK, TIME
Example
The following shows how to use SECNDS to perform elapsed-time computations:
C START OF TIMED SEQUENCE
T1 = SECNDS(0.0)
C CODE TO BE TIMED
...
DELTA = SECNDS(T1) ! DELTA gives the elapsed time
Portability Function: Returns the number of seconds that have elapsed since midnight, less the value of its argument.
Module: USE IFPORT
Syntax
result = SECNDS (r)
r
(Input) REAL(4). Number of seconds, precise to a hundredth of a second (0.01), to be subtracted.
Results
The result type is REAL(4). The result value is the number of seconds that have elapsed since midnight, minus r, with a precision of a hundredth of a second (0.01).
To start the timing clock, call SECNDS with 0.0, and save the result in a local variable. To get the elapsed time since the last call to SECNDS, pass the local variable to SECNDS on the next call.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also
DATE_AND_TIME, RTC, SYSTEM_CLOCK, TIME
Example
USE IFPORT
REAL(4) s
INTEGER(4) i, j
s = SECNDS(0.0)
DO I = 1, 100000
J = J + 1
END DO
s = SECNDS(s)
PRINT *, 'It took ',s, 'seconds to run.'