parse_timeunit_i8 Subroutine

public subroutine parse_timeunit_i8(tunit, n, t0, dt, rc)

Uses

  • proc~~parse_timeunit_i8~~UsesGraph proc~parse_timeunit_i8 parse_timeunit_i8 ESMF ESMF proc~parse_timeunit_i8->ESMF

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: tunit
integer(kind=ESMF_KIND_I8), intent(in) :: n
type(ESMF_Time), intent(out) :: t0
type(ESMF_TimeInterval), intent(out) :: dt
integer, intent(out), optional :: rc

Calls

proc~~parse_timeunit_i8~~CallsGraph proc~parse_timeunit_i8 parse_timeunit_i8 ESMF_TimeIntervalSet ESMF_TimeIntervalSet proc~parse_timeunit_i8->ESMF_TimeIntervalSet ESMF_TimeSet ESMF_TimeSet proc~parse_timeunit_i8->ESMF_TimeSet interface~mapl_assert MAPL_Assert proc~parse_timeunit_i8->interface~mapl_assert proc~mapl_return MAPL_Return proc~parse_timeunit_i8->proc~mapl_return proc~mapl_verify MAPL_Verify proc~parse_timeunit_i8->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Called by

proc~~parse_timeunit_i8~~CalledByGraph proc~parse_timeunit_i8 parse_timeunit_i8 interface~parse_timeunit parse_timeunit interface~parse_timeunit->proc~parse_timeunit_i8 proc~parse_timeunit_i4 parse_timeunit_i4 interface~parse_timeunit->proc~parse_timeunit_i4 proc~diff_two_timeunits diff_two_timeunits proc~diff_two_timeunits->interface~parse_timeunit proc~parse_timeunit_i4->interface~parse_timeunit proc~time_esmf_2_nc_int time_esmf_2_nc_int proc~time_esmf_2_nc_int->interface~parse_timeunit proc~time_nc_int_2_esmf time_nc_int_2_esmf proc~time_nc_int_2_esmf->interface~parse_timeunit interface~convert_time_esmf2nc convert_time_esmf2nc interface~convert_time_esmf2nc->proc~time_esmf_2_nc_int interface~convert_time_nc2esmf convert_time_nc2esmf interface~convert_time_nc2esmf->proc~time_nc_int_2_esmf

Source Code

  subroutine parse_timeunit_i8(tunit, n, t0, dt, rc)
    use ESMF
    implicit none

    character(len=*), intent(in) :: tunit
    integer(ESMF_KIND_I8), intent(in) :: n
    type(ESMF_Time), intent(out) :: t0
    type(ESMF_TimeInterval), intent(out) :: dt
    integer, optional, intent(out) :: rc
    integer :: status

    integer :: i
    character(len=ESMF_MAXSTR) :: s1, s2, s_time, s_unit
    character(len=1) :: c1
    integer :: y,m,d,hour,min,sec
    integer(ESMF_KIND_I8) :: isec

    i=index(trim(tunit), 'since')
    s_time=trim(tunit(i+5:))
    s_unit=trim(tunit(1:i-1))
    read(s_time,*) s1, s2
    read(s1, '(i4,a1,i2,a1,i2)') y, c1, m, c1, d
    read(s2, '(i2,a1,i2,a1,i2)') hour, c1, min, c1, sec

!    write(6,*) 'y, c1, m, c1, d',  y, c1, m, c1, d
!    write(6,*) 'hour, c1, min, c1, sec', hour, c1, min, c1, sec

    if (trim(s_unit) == 'seconds') then
       isec=n
    elseif (trim(s_unit) == 'minutes') then
       isec=n * 60
    elseif (trim(s_unit) == 'hours') then
       isec=n * 3600
    else
       _FAIL ('time_unit not implemented')
    end if

    call ESMF_timeSet(t0, yy=y,mm=m,dd=d,h=hour,m=min,s=sec, _RC)
    call ESMF_timeintervalSet(dt, d=0, h=0, m=0, s_i8=isec, _RC)
    _RETURN(_SUCCESS)

  end subroutine parse_timeunit_i8