time

Date:

06-19-2023

NAME

TIME - Returns the current time as set within the system

SYNOPSIS

CALL TIME ([BUF=]current_sys_time)
CHARACTER :: current_sys_time

STANDARDS

Fortran extension

DESCRIPTION

The TIME intrinsic subroutine returns the current time as set within the system.

Note: The name of this intrinsic cannot be passed as an argument.

This function accepts the following argument:

current_sys_time

Returns the current system time as eight characters. current_sys_time may be a character variable, array, array element, or substring.

  • If current_sys_time is an array, the time is stored only in the first element. This element should be at least 8 characters wide.

  • If the size of current_sys_time is less than 8 characters wide, only the left-most characters are returned.

NOTES

The TIME intrinsic subroutine is outmoded. Refer to Cray Fortran Reference Manual for information on outmoded features. The preferred replacement for TIME is a call to the DATE_AND_TIME subroutine from the ANSI/ISO Fortran standard.

RETURN VALUES

TIME returns an 8-byte ASCII character string with this format: hh:mm:ss. Where hh is the hours in 2 characters, mm is minutes in 2 characters, and ss is the seconds in 2 characters. This intrinsic subroutine uses a 24-hour clock.

EXAMPLES

Example 1.

CHARACTER(8) :: ATIME
...
CALL TIME (ATIME)

An example of a value returned from a call to TIME is 13:45:23.

Example 2. Consider the following:

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

In this example, TIME is passed a CHARACTER array that has 8 1-character elements. Because TIME returns the time information only in the first element of the array (which is a 1-character element), only 1 character of time information is returned – the left-most character. If the current time is 13:45:23, TIME returns 1 in the HOUR array.

SEE ALSO

date_and_time(3i)