Intel® Fortran Compiler 18.0 Developer Guide and Reference

LTIME

Portability Subroutine: Returns the components of the local time zone time in a nine-element array.

Module

USE IFPORT

CALL LTIME (time,array)

time

(Input) INTEGER(4). An elapsed time in seconds since 00:00:00 Greenwich mean time, January 1, 1970.

array

(Output) INTEGER(4). One-dimensional array with 9 elements to contain local date and time data derived from time.

The elements of array are returned as follows:

Element

Value

array(1)

Seconds (0 - 59)

array(2)

Minutes (0 - 59)

array(3)

Hours (0 - 23)

array(4)

Day of month (1 - 31)

array(5)

Month (0 - 11)

array(6)

Years since 1900

array(7)

Day of week (0 - 6, where 0 is Sunday)

array(8)

Day of year (1 - 365)

array(9)

1 if daylight saving time is in effect; otherwise, 0.

CAUTION

This subroutine is not year-2000 compliant, use DATE_AND_TIME instead.

On Linux* and macOS*, time can be a negative number returning the time before 00:00:00 Greenwich mean time, January 1, 1970. On Windows*, time can not be negative, in which case all 9 elements of array are set to -1. On all operating systems, if there is a system error in getting the local time, all 9 elements of array are set to -1.

Example

USE IFPORT
INTEGER(4) input_time, time_array(9)
!   find number of seconds since 1/1/70
input_time=TIME()
!   convert number of seconds to time array
CALL LTIME (input_time, time_array)
PRINT *, time_array

See Also