TIME

TIME can be used as an intrinsic subroutine or as a portability routine.


TIME Intrinsic Subroutine

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 DLL LIB

See Also: DATE_AND_TIME

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.


TIME Portability Routine

Portability Function and 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 DFPORT

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 is of type INTEGER(4). The result is the number of seconds that have elapsed since 00:00:00 Greenwich mean time, January 1, 1970.

The value returned by this function is used as input to other Portability date and time functions.

You can use both the function and subroutine versions of TIME only if your program includes the USE DFPORT statement.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: DATE_AND_TIME

Example

 USE DFPORT
 INTEGER(4) int_time
 character*8 char_time
 int_time = TIME( )
 call TIME(char_time)
 print *, 'Integer: ', int_time, 'time: ', char_time
 END