TIME can be used as an intrinsic subroutine or as a portability function or subroutine. It is an intrinsic procedure unless you specify USE IFPORT.
Intrinsic Subroutine: Returns the current time as set within the system.
Syntax
CALL TIME (buf)
buf
Is a 8-byte variable, array, array element, or character substring.
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.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS LIB
See Also
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.
Portability Function or Subroutine: The function returns the system time, in seconds, since 00:00:00 Greenwich mean time, January 1, 1970. The subroutine fills a parameter with the current time as a string in the format hh:mm:ss.
Module: USE IFPORT
Function Syntax:
result = TIME( )
Subroutine Syntax:
CALL TIME (string)
string
(Output) Character*(*). Current time, based on a 24-hour clock, in the form hh:mm:ss, where hh, mm, and ss are two-digit representations of the current hour, minutes past the hour, and seconds past the minute, respectively.
Results
The result type is INTEGER(4). The result value is the number of seconds that have elapsed since 00:00:00 Greenwich mean time, January 1, 1970.
The value returned by this routine can be used as input to other portability date and time functions.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also
Example
USE IFPORT
INTEGER(4) int_time
character*8 char_time
int_time = TIME( )
call TIME(char_time)
print *, 'Integer: ', int_time, 'time: ', char_time
END