Fortran Library Reference

ctime: Convert System Time to Character

The function ctime converts a system time, stime, and returns it as a 24-character ASCII string.

The function is called by:

CHARACTER ctime*24

string = ctime( stime )

stime

INTEGER*4

Input 

System time from time() (standard version)

Return value 

character*24

Output 

System time as character string. Declare ctime and string as character*24.

The format of the ctime returned value is shown in the following example. It is described in the man page ctime(3C).

Example: ctime():


    character*24 ctime, string
    INTEGER*4  n, time
    n = time()
    string = ctime( n )
    write(*,*) 'ctime: ', string
    end
demo% f77 -silent tctime.f 
demo% a.out 
 ctime: Wed Dec  9 13:50:05 1998 
demo%