Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

SECNDS Intrinsic Procedure

Elemental Intrinsic Function (Generic): Provides the system time of day, or elapsed time, as a floating-point value in seconds. SECNDS can be used as an intrinsic function or as a portability routine. It is an intrinsic procedure unless you specify USE IFPORT.

This function must not be passed as an actual argument. It is not a pure function, so it cannot be referenced inside a FORALL construct.

result = SECNDS (x)

x

(Input) Must be of type real.

Results

The result type and kind are the same as x.

If x is zero, the result value is the time in seconds since the most recent midnight (in local time).

If x is not zero, it is compared to now: the value that would be returned if x had been zero. If x is less than now, then the result value is now - x. If x is more than now, the function assumes that x is the result of a call to SECONDS made the previous day and returns the value between that time and now.

This function cannot detect a delay of more than one day between calls. For timing intervals longer than 24 hours, use DCLOCK.

This function does not account for daylight savings changes in either direction.

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.

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