Returns elapsed CPU time in seconds.
FORTRAN:
val = second()
val = dsecnd()
C:
val = second();
val = dsecnd();
Name |
Type |
Description |
---|---|---|
val |
FORTRAN: REAL for second DOUBLE PRECISION for dsecnd C: float for second double for dsecnd |
Elapsed CPU time in seconds |
The second/dsecnd functions return the elapsed CPU time in seconds. The difference between these functions is that dsecnd returns the result with double precision.
Apply each function in pairs: the first time, directly before a call to the routine to be measured, and the second time - after the measurement. The difference between the returned values is the time spent in the routine.
The second/dsecnd functions get the time from the elapsed CPU clocks divided by frequency. Obtaining the frequency may take some time when the second/dsecnd function runs for the first time. To eliminate the effect of this extra time on your measurements, make the first call to second/dsecnd in advance.
Do not use second for measuring short time intervals because the single-precision format is not capable of holding sufficient timer precision.