Fotran intrinsic procedures : time

学习内部函数的目的:

内部函数提供了一些基本的操作,甚至一些操作只能通过内部函数来实现。

program main
    implicit none 
    !call date_and_time([date] [,time] [,zone] [,values])
    !date  a string of length 8 or more , form ccyymmdd(yyyymmdd)
    !time  a string of length 10 or more, form hhmmss.sss millisecond
    !zone  a string of length 5 or more,  form Shhmm S:sign
    !values is a rank_one (rank means dimension here) default integer array of size at least 8
    !sequence : year, month , day, the times difference in minutes with respect to UTC, hour,  minute, second, millisecond
    character(len=10):: date, time, zone
    integer,dimension(8) :: values 
    call date_and_time(date, time, zone, values)
    write(*,*) "date=",trim(date)
    write(*,*) "time=",trim(time)
    write(*,*) "zone=",trim(zone)
    write(*,*) values 
end program main  
program main
    implicit none 
    !call system_clock([[count] [,count_rate] [,count_max])
    ! all default integer
    integer :: count, count_rate, count_max 
    call system_clock(count, count_rate, count_max )
    write(*,*) count 
    write(*,*) count_rate 
    write(*,*) count_max 
    write(*,*) "NEW"
    call system_clock(count, count_rate, count_max )
    write(*,*) count 
    write(*,*) count_rate 
    write(*,*) count_max 
end program main  

     2626598
        1000
  2147483647
 NEW
     2626598
        1000
  2147483647

猜你喜欢

转载自blog.csdn.net/qq_40436147/article/details/84256009