time_string Function

public function time_string(time_start) result(time_str)

Returns time string

Arguments

TypeIntentOptionalAttributesName
integer, intent(in), optional dimension(8):: time_start

Optional start time

Return Value character(len=30)

Time string


Called by

proc~~time_string~~CalledByGraph proc~time_string time_string proc~neutron_f neutron_f proc~neutron_f->proc~time_string program~fidasim fidasim program~fidasim->proc~time_string program~fidasim->proc~neutron_f proc~neutron_mc neutron_mc program~fidasim->proc~neutron_mc proc~cfpd_f cfpd_f program~fidasim->proc~cfpd_f proc~fida_weights_mc fida_weights_mc program~fidasim->proc~fida_weights_mc proc~npa_weights npa_weights program~fidasim->proc~npa_weights proc~fida_weights_los fida_weights_los program~fidasim->proc~fida_weights_los proc~neutron_mc->proc~time_string proc~cfpd_f->proc~time_string proc~fida_weights_mc->proc~time_string proc~npa_weights->proc~time_string proc~fida_weights_los->proc~time_string program~generate_tables generate_tables program~generate_tables->proc~time_string

Contents

Source Code


Source Code

function time_string(time_start) result (time_str)
    !+ Returns time string
    integer, dimension(8), intent(in), optional :: time_start
        !+ Optional start time
    character(30) :: time_str
        !+ Time string

    integer :: ts(8), ta(8), hour, minu, sec

    ts = 0
    if(present(time_start)) then
        ts = time_start
    endif

    call date_and_time(values=ta)
    hour = ta(5) - ts(5)
    minu = ta(6) - ts(6)
    sec  = ta(7) - ts(7)
    if (minu.lt.0.) then
        minu = minu + 60
        hour = hour - 1
    endif
    if (sec.lt.0.) then
        sec  = sec + 60
        minu = minu - 1
    endif

    if(present(time_start)) then
        write(time_str,'(I2,":",I2.2,":",I2.2," --- elapsed:",I2,":",I2.2,":",I2.2)') &
            ta(5),ta(6),ta(7), hour,minu,sec
    else
        write(time_str,'(I2,":",I2.2,":",I2.2)') &
            ta(5),ta(6),ta(7)
    endif

end function time_string