Fortran中使用system_clock进行程序运行时间计算
(2017-04-07 23:30:41)
标签:
fortran |
分类: 编程 |
system_clock(count,count_rate,count_max)
count是从世界协调时间1970/1/1
8:0:0开始至当前时间点的时间差值,单位是秒。
如:1970/1/1 8:0:0
count=0
count_rate是指处理器时钟数
count_max是count能达到的最大数,即count在0~count_max之间,但count达到count_max的下一秒,就溢满归0。
count_max=2147483647 对应2038/1/19 11:14:7
program Main
implicit none
integer :: t1, t2, time_cal
call system_clock(t1)
!主体程序
call system_clock(t2)
time_cal=t2-t1
write(*,*) " The program's calculation time is", time_cal,
"seconds"
stop " Calculation is over "
end program Main