Sun Studio 12: Fortran Library Reference

1.4.51.4 gmtime: Split System Time to Month, Day, … (GMT)

This routine dissects a system time into month, day, and so on, for GMT.

The subroutine is:

call gmtime( stime, tarray )

stime

INTEGER*4

Input 

System time from time() (standard version)

tarray

INTEGER*4(9)

Output 

System time, GMT, as day, month, year, … 

Example: gmtime:


demo% cat tgmtime.f
        integer*4  stime, tarray(9), time
        stime = time()
        call gmtime( stime, tarray )
        write(*,*) ’gmtime: ’, tarray
        end
demo% f95t tgmtime.f
demo% a.out
 gmtime:   12  44  19  18  5  94  6  168  0
demo%

Here are the tarray() values for ltime and gmtime: index, units, and range:

Seconds (0 - 61) 

Minutes (0 - 59) 

Hours (0 - 23) 

Day of month (1 - 31) 

Months since January (0 - 11) 

Year - 1900 

Day of week (Sunday = 0) 

Day of year (0 - 365) 

Daylight Saving Time, 1 if DST in effect 

These values are defined by the C library routine ctime(3C), which explains why the system may return a count of seconds greater than 59. See also: idate(3F), and fdate(3F).