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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

TIME Intrinsic Procedure

Intrinsic Subroutine (Generic): Returns the current time as set within the system. TIME can be used as an intrinsic subroutine or as a portability routine. It is an intrinsic procedure unless you specify USE IFPORT. Intrinsic subroutines cannot be passed as actual arguments.

CALL TIME (buf)

buf

(Output) Is a variable, array, or array element of any data type, or a character substring. It must contain at least eight bytes of storage.

The date is returned as a 8-byte ASCII character string taking the form hh:mm:ss, where:

hh

is the 2-digit hour

mm

is the 2-digit minute

ss

is the 2-digit second

If buf is of numeric type and smaller than 8 bytes, data corruption can occur.

If buf is of character type, its associated length is passed to the subroutine. If buf is smaller than 8 bytes, the subroutine truncates the date to fit in the specified length. If an array of type character is passed, the subroutine stores the date in the first array element, using the element length, not the length of the entire array.

Example

CHARACTER*1 HOUR(8)
...
CALL TIME (HOUR)

The length of the first array element in CHARACTER array HOUR is passed to the TIME subroutine. The subroutine then truncates the time to fit into the 1-character element, producing an incorrect result.