second

Date:

02-06-2023

NAME

SECOND - Returns elapsed CPU usage time

SYNOPSIS

REAL(4) second
second=SECOND()

REAL(8) second
second=SECOND_8()

DESCRIPTION

SECOND returns the elapsed user CPU usage time as a real number in seconds since the start of a program, including time accumulated by the program.

SECOND returns execution time only for the current program. For example, a script runs a 50-second program 10 times. A SECOND call at the end of the 10th run (or 1st or 3rd or 7th) returns the CPU usage time from the 10th run, up to 50 seconds.

SECOND is not appropriate for timing small timed regions.

NOTES

If the -s default64 option is specified for the Fortran compilation, the entry point SECOND_8 should be used.

EXAMPLES

Example 1:

This example calculates the CPU time used in DOWORK:

REAL(KIND=4) BEFORE, AFTER, CPUTIME
REAL(KIND=4) SECOND

BEFORE = SECOND( )
CALL DOWORK( )
AFTER = SECOND( )
CPUTIME = AFTER - BEFORE

SEE ALSO

RTC(3I), SECONDR(3F), TIMEF(3F)

time(1)