Fortran Library Reference

time: Get System Time

For time(), there are two versions, a standard version and a VMS version. If you use the f77 command-line option -lV77, then you get the VMS version for time() and for idate(); otherwise, you get the standard versions.

The standard function is called by:

INTEGER*4 time or INTEGER*8

n = time() Standard Version

Return value 

INTEGER*4

 Output

Time, in seconds, since 0:0:0, GMT, 1/1/70 

INTEGER*8 OutputIn 64-bit environments, time returns an INTEGER*8 value

The function time() returns an integer with the time since 00:00:00 GMT, January 1, 1970, measured in seconds. This is the value of the operating system clock.

Example: time(), version standard with the operating system:


    INTEGER*4  n, time
    n = time()
    write(*,*) 'Seconds since 0 1/1/70 GMT = ', n
    end
demo% f77 -silent ttime.f
demo% a.out 
 Seconds since 0 1/1/70 GMT =   913240205
demo% 

The VMS version of time is a subroutine that gets the current system time as a character string.

The VMS subroutine is called by:

call time( t ) VMS Version

t

character*8

Output 

Time, in the form hh:mm:ss hh, mm, and ss are each two digits: hh is the hour; mm is the minute; ss is the second

Example: time(t), VMS version, ctime--convert the system time to ASCII:


    character  t*8
    call time( t )
    write(*, "(' The current time is ', A8 )")  t
    end
demo% f77 -silent ttimeV.f -lV77 
demo% a.out 
 The current time is 08:14:13 
demo%