TIME(3F)
NAME
time, ctime, ctime64, ltime, ltime64, gmtime, gmtime64 − return system time
SYNOPSIS
INTEGER∗4 FUNCTION time()
standard FORTRAN version in 32-bit environments INTEGER∗8 FUNCTION time()
standard FORTRAN version in 64-bit SPARC environments CHARACTER∗8 t
CALL time(t)
VMS version INTEGER n
CHARACTER∗24 FUNCTION ctime(n) INTEGER∗8 n8
CHARACTER∗24 FUNCTION ctime64(n8) INTEGER∗4 stime, tarray(9)
CALL ltime(stime, tarray) INTEGER∗8 stime8
INTEGER∗4 tarray(9)
CALL ltime64(stime8, tarray) INTEGER∗4 stime, tarray(9)
CALL gmtime(stime, tarray) INTEGER∗8 stime8
INTEGER∗4 tarray(9)
CALL gmtime64(stime8, tarray)
DESCRIPTION
The function time has two versions. The standard version is available by default. The VMS version is available when the calling program is compiled with the -lV77 option.
Standard Version:
Function: time() returns an integer that contains the time since 00:00:00 GMT, Jan. 1, 1970, measured in seconds. This is the value of the operating system clock. Usage:
integer∗4 n, time
n = time()
VMS Version:
Subroutine: time gets the current system time as a character string. Usage:
call time( t )
where t is of type character∗8, with the form hh:mm:ss.
hh, mm, and ss are two digits; hh is hour; mm is minute; and ss is second.
Example:
demo% cat tim1.f
character t∗8
call time( t )
write( ∗, "(’ The time is: ’, A8 )" ) t
end
demo% f77 −silent tim1.f −lV77
demo% a.out
The time is: 08:14:13
demo%
ctime returns the system time, stime, as a 24-character string. For example, the program:
character∗24 ctime
integer∗4 time
print∗, ctime(time())
end
prints the following:
Tue Sep 8 17:01:03 1998
ltime and gmtime split system time into various time units for the local time zone (ltime) or as GMT (gtmtime). These units are returned in a nine-element INTEGER∗4 array as follows: tarray 1 through 9, index, units, and range:
1 Seconds (0 - 61)
2 Minutes (0 - 59)
3 Hours (0 - 23)
4 Day of month (1 - 31)
5 Months since January (0 - 11)
6 Year - 1900
7 Day of week (Sunday = 0)
8 Day of year (0 - 365)
9 Daylight Standard Time, 1 if DST in effect
NOTES
64-bit versions of ctime, ltime, and gmtime are provided. These take an INTEGER∗8 time value. After January 19, 2038, at 3:14:07 GMT, the time() value of seconds since January 1, 1970 will exceed the range of INTEGER∗4. To calculate such dates with these routines, use the 64-bit versions and an INTEGER∗8 argument. When compiled to run in a 64-bit environment, time() will return an INTEGER∗8 value. Compiling for 64-bit environments means compiling the program with the -xarch=v9 option and running the program on a 64-bit SPARC platform in a 64-bit Solaris operating environment.
FILES
libF77.a, libV77.a
SEE ALSO
Fortran Library Reference Manual
itime(3F), idate(3F), fdate(3F) ctime(3C)
For the C version of ctime, type: man −s 3C ctime
SunOS WorkShop_5.0 — Last change: 98/09/16