string_to_esmf_timeinterval Function

public function string_to_esmf_timeinterval(time_interval_string, unusable, rc) result(time_interval)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: time_interval_string
class(KeywordEnforcer), intent(in), optional :: unusable
integer, intent(out), optional :: rc

Return Value type(ESMF_TimeInterval)


Calls

proc~~string_to_esmf_timeinterval~~CallsGraph proc~string_to_esmf_timeinterval string_to_esmf_timeinterval ESMF_TimeIntervalSet ESMF_TimeIntervalSet proc~string_to_esmf_timeinterval->ESMF_TimeIntervalSet interface~mapl_assert MAPL_Assert proc~string_to_esmf_timeinterval->interface~mapl_assert proc~mapl_return MAPL_Return proc~string_to_esmf_timeinterval->proc~mapl_return proc~mapl_verify MAPL_Verify proc~string_to_esmf_timeinterval->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~~string_to_esmf_timeinterval~~CalledByGraph proc~string_to_esmf_timeinterval string_to_esmf_timeinterval none~create_from_parameters ExtDataPointerUpdate%create_from_parameters none~create_from_parameters->proc~string_to_esmf_timeinterval proc~fillin_derived ExtDataOldTypesCreator%fillin_derived proc~fillin_derived->none~create_from_parameters proc~fillin_primary ExtDataOldTypesCreator%fillin_primary proc~fillin_primary->none~create_from_parameters

Source Code

   function string_to_esmf_timeinterval(time_interval_string,unusable,rc) result(time_interval)
      character(len=*), intent(in) :: time_interval_string
      class(KeywordEnforcer), optional, intent(in) :: unusable
      integer, optional, intent(out) :: rc

      type(ESMF_TimeInterval) :: time_interval
      integer :: status

      integer :: strlen,ppos,cpos,lpos,tpos
      integer year,month,day,hour,min,sec
      character(len=:), allocatable :: date_string,time_string
      _UNUSED_DUMMY(unusable)

      year=0
      month=0
      day=0
      hour=0
      min=0
      sec=0
      strlen = len_trim(time_interval_string)
      tpos = index(time_interval_string,'T')
      ppos = index(time_interval_string,'P')
      _ASSERT(time_interval_string(1:1) == 'P','Not valid time duration')

      if (tpos /= 0) then
         if (tpos /= ppos+1) then
            date_string = time_interval_string(ppos+1:tpos-1)
         end if
         time_string = time_interval_string(tpos+1:strlen)
      else
         date_string = time_interval_string(ppos+1:strlen)
      end if

      if (allocated(date_string)) then
         strlen = len_trim(date_string)
         lpos = 0
         cpos = index(date_string,'Y')
         if (cpos /= 0) then
            read(date_string(lpos+1:cpos-1),*)year
            lpos = cpos
         end if
         cpos = index(date_string,'M')
         if (cpos /= 0) then
            read(date_string(lpos+1:cpos-1),*)month
            lpos = cpos
         end if
         cpos = index(date_string,'D')
         if (cpos /= 0) then
            read(date_string(lpos+1:cpos-1),*)day
            lpos = cpos
         end if
      end if
      if (allocated(time_string)) then
         strlen = len_trim(time_string)
         lpos = 0
         cpos = index(time_string,'H')
         if (cpos /= 0) then
            read(time_string(lpos+1:cpos-1),*)hour
            lpos = cpos
         end if
         cpos = index(time_string,'M')
         if (cpos /= 0) then
            read(time_string(lpos+1:cpos-1),*)min
            lpos = cpos
         end if
         cpos = index(time_string,'S')
         if (cpos /= 0) then
            read(time_string(lpos+1:cpos-1),*)sec
            lpos = cpos
         end if
      end if

      call ESMF_TimeIntervalSet(time_interval,yy=year,mm=month,d=day,h=hour,m=min,s=sec,_RC)
      _RETURN(_SUCCESS)

   end function string_to_esmf_timeinterval