.\" @(#)time.3f 1.5 86/01/02 SMI; from UCB 4.2 .TH TIME 3F "99/11/09" .SH NAME time, ctime, ctime64, ltime, ltime64, gmtime, gmtime64 \- return system time .SH SYNOPSIS .na .\" .B INTEGER*4 FUNCTION time() .br standard FORTRAN version in 32-bit environments .sp .B INTEGER*8 FUNCTION time() .br standard FORTRAN version in 64-bit SPARC environments .sp .B CHARACTER*8 t .br .B CALL time(t) .br VMS version .sp .B INTEGER n .br .B CHARACTER*24 FUNCTION ctime(n) .sp .B INTEGER*8 n8 .br .B CHARACTER*24 FUNCTION ctime64(n8) .sp .B INTEGER*4 stime, tarray(9) .br .B CALL ltime(stime, tarray) .sp .B INTEGER*8 stime8 .br .B INTEGER*4 tarray(9) .br .B CALL ltime64(stime8, tarray) .sp .B INTEGER*4 stime, tarray(9) .br .B CALL gmtime(stime, tarray) .sp .B INTEGER*8 stime8 .br .B INTEGER*4 tarray(9) .br .B CALL gmtime64(stime8, tarray) .sp .fi .ad .\" .SH DESCRIPTION .\" The function .B time has two versions. The standard version is available by default. The VMS version is available when the calling program is compiled with the f77 compiler .B -lV77 option. (f77 only.) .PP Standard Version: .in +2 .sp .2 Function: .B 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. .sp .2 Usage: .in +2 .sp .2 .nf .ft 3 integer*4 n, time n = time() .ft 1 .fi .in -4 .PP VMS Version: .in +2 .sp .2 Subroutine: .B time gets the current system time as a character string. .sp .2 Usage: .in +2 .br .B "call time( t )" .br where .B t is of type .BR "character*8" , with the form .BR "hh:mm:ss" . .br .BR hh , .BR mm , and .B ss are two digits; .B hh is hour; .B mm is minute; and .B ss is second. .\" .in -2 .sp Example: .in +2 .sp .2 demo% .B "cat tim1.f" .br .nf .ft 3 character t*8 call time( t ) write( *, "(' The time is: ', A8 )" ) t end .ft 1 .fi demo% .B "f77 \-silent tim1.f \-lV77" .br demo% .B a.out .br \ The time is: 08:14:13 .br demo% .PP .B ctime returns the system time, .IR stime , as a 24-character string. For example, the program: .br .nf .ft 3 character*24 ctime integer*4 time print*, ctime(time()) end .ft 1 .sp prints the following: .br .nf .ft 3 Tue Sep 8 17:01:03 1998 .ft 1 .fi .PP .B ltime and .B 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: .sp .B tarray 1 through 9, index, units, and range: .sp .2 .nf .na 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 .fi .ad .\" .SH NOTES .\" 64-bit versions of .B ctime, ltime, and .B gmtime are provided. These take an INTEGER*8 time value. .sp 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. .sp When compiled to run in a 64-bit environment, .B time() will return an INTEGER*8 value. Compiling for 64-bit environments means compiling the program with the .B -xarch=v9 option and running the program on a 64-bit SPARC platform in a 64-bit Solaris operating environment. .SH FILES .\" .BR libF77.a , .B libV77.a .\" .SH "SEE ALSO" .\" .I "Fortran Library Reference Manual" .br .BR itime (3F), .BR idate (3F), .B fdate(3F) .BR ctime (3C) .PP For the C version of .BR ctime , type: .B "man \-s\ 3C ctime"