subroutine idate(iarray) integer*4 iarray(3)
subroutine idate(m, d, y) integer*4 m, d, y
idate 具有标准版本和 VMS 版本。VMS 版本不是 Y2K 安全的。
idate 子例程将当前日期放置到整数数组 iarray 中。顺序为:天、月份、年份。月份的范围是 1-12。年份为四位数字,例如 1997 或 2001。示例:
demo% cat ida2.f integer*4 a(3) call idate( a ) write(*, "(' The date is: ',3i5)" ) a end demo% f77 -silent ida2.f demo% a.out The date is: 23 1 1997 demo%
使用 -lV77 标志编译。
idate 子例程将当前日期放置到整数 m、d 和 y 中。VMS 版本仅允许使用 2 位数并且不是 Y2K 安全的。示例:
demo% cat ida1.f integer*4 m, d, y call idate( m, d, y ) write(*, "(' The date is: ',3i3)" ) m, d, y end demo% f77 ida1.f -lV77 ida1.f: MAIN: "ida1.f", line 2: Warning: Subroutine "idate" is not safe after year 2000; use "date_and_time" instead demo% a.out Computing time differences using the 2 digit year from subroutine idate is not safe after year 2000. The date is: 7 23 97 demo%
libF77.a、libV77.a
VMS 版本不是 Y2K 安全的。因为处于 VMS 模式的 idate 会返回一个 2 位数的年份,所以不应当使用它来比较未考虑此情况的日期。 fdate (3F) 和 date_and_time (3F) 返回 4 位数的年份,因此可以改用它们。
因为 idate 不是 Y2K 安全的,所以在 VMS 模式中使用此例程的程序在编译和执行时将生成警告消息。
使用 f77 编译器 -lV77 标志进行编译时,将与 idate() 和 time() 的 VMS 版本相链接。(仅限 f77)
date (3F) 、 fdate (3F) 、 date_and_time (3F)
《FORTRAN 77 Reference Manual》