ESMF_TimeIntervalSetStr Subroutine

private subroutine ESMF_TimeIntervalSetStr(timeinterval, timeIntervalString, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_TimeInterval), intent(inout) :: timeinterval
character(len=*), intent(in) :: timeIntervalString
integer, intent(out), optional :: rc

Calls

proc~~esmf_timeintervalsetstr~~CallsGraph proc~esmf_timeintervalsetstr ESMF_TimeIntervalSetStr proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_timeintervalsetstr->proc~esmf_logfounderror proc~esmf_parsedurstring ESMF_ParseDurString proc~esmf_timeintervalsetstr->proc~esmf_parsedurstring proc~esmf_timeintervalsetdur ESMF_TimeIntervalSetDur proc~esmf_timeintervalsetstr->proc~esmf_timeintervalsetdur esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_parsedurstring->proc~esmf_logfounderror proc~esmf_logseterror ESMF_LogSetError proc~esmf_parsedurstring->proc~esmf_logseterror proc~esmf_parsedurdatestring ESMF_ParseDurDateString proc~esmf_parsedurstring->proc~esmf_parsedurdatestring proc~esmf_parsedurtimestring ESMF_ParseDurTimeString proc~esmf_parsedurstring->proc~esmf_parsedurtimestring proc~esmf_timeintervalsetdur->proc~esmf_logfounderror c_esmc_timeintervalsetdur c_esmc_timeintervalsetdur proc~esmf_timeintervalsetdur->c_esmc_timeintervalsetdur proc~esmf_timeintervalinit ESMF_TimeIntervalInit proc~esmf_timeintervalsetdur->proc~esmf_timeintervalinit c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg proc~esmf_logseterror->esmf_breakpoint proc~esmf_logseterror->proc~esmf_logrc2msg proc~esmf_logseterror->proc~esmf_logwrite c_esmc_vmwtime c_esmc_vmwtime proc~esmf_logwrite->c_esmc_vmwtime proc~esmf_logclose ESMF_LogClose proc~esmf_logwrite->proc~esmf_logclose proc~esmf_logflush ESMF_LogFlush proc~esmf_logwrite->proc~esmf_logflush proc~esmf_logopenfile ESMF_LogOpenFile proc~esmf_logwrite->proc~esmf_logopenfile proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_logwrite->proc~esmf_utiliounitflush proc~esmf_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array proc~esmf_parsedurdatestring->proc~esmf_logseterror proc~esmf_parsedurtimestring->proc~esmf_logseterror proc~esmf_logclose->proc~esmf_logflush proc~esmf_logflush->proc~esmf_utiliounitflush proc~esmf_utilarray2string ESMF_UtilArray2String proc~esmf_logflush->proc~esmf_utilarray2string proc~esmf_logopenfile->proc~esmf_utiliounitflush proc~esmf_utiliounitget ESMF_UtilIOUnitGet proc~esmf_logopenfile->proc~esmf_utiliounitget

Called by

proc~~esmf_timeintervalsetstr~~CalledByGraph proc~esmf_timeintervalsetstr ESMF_TimeIntervalSetStr interface~esmf_timeintervalset ESMF_TimeIntervalSet interface~esmf_timeintervalset->proc~esmf_timeintervalsetstr

Source Code

      subroutine ESMF_TimeIntervalSetStr(timeinterval, timeIntervalString, rc)

! !ARGUMENTS:
      type(ESMF_TimeInterval), intent(inout)         :: timeinterval
      character(*),            intent(in)            :: timeIntervalString  
      integer,                 intent(out), optional :: rc

!
!
! !DESCRIPTION:
!     Sets the value of an {\tt ESMF\_TimeInterval} using a
!     string in ISO 8601 duration format P[y]Y[mm]M[d]DT[h]H[m]M[s]S. See ~\cite{ISO} and ~\cite{ISOnotes} for information about the format. In ESMF's implementation the time values can have the following types: 
!     \begin{description}
!      \item[y] - the number of years expressed in up to a 64-bit integer
!      \item[mm] - the number of months expressed in up to a 64-bit integer
!      \item[d]  - the number of days expressed in up to a 64-bit integer or a 64-bit floating point value (double)
!      \item[h] - the number of hours expressed in up to a 32-bit integer or a 64-bit floating point value (double)
!      \item[m] - the number of minutes expressed in up to a 32-bit integer or a 64-bit floating point value (double)
!      \item[s] - the number of seconds expressed in up to a 64-bit integer or a 64-bit floating point value (double)
!     \end{description}
!
!   As with the ISO format, in ESMF's implementation the specifier and value can be left out if the value is 0. For example, P1YT1H3M4S is a valid format if the number of months and
!   days are both 0. The time part including the T can also be left off if the time values are all 0, so P1Y is a valid string if just 1 year is being specified. 
!      
!     The arguments are:
!     \begin{description}
!     \item[timeinterval]
!          The object instance to initialize.
!     \item[timeIntervalString]
!          ISO 8601 format duration string (e.g. P[y]Y[mm]M[d]DT[h]H[m]M[s]S).
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!EOP
! !REQUIREMENTS:
!     TMGn.n.n
      integer :: localrc                        ! local return code
      integer(ESMF_KIND_I8) :: yy_i8
      integer(ESMF_KIND_I8) :: mm_i8
      integer(ESMF_KIND_I8) :: d_i8
      integer(ESMF_KIND_I8) :: s_i8
      real(ESMF_KIND_R8)    :: d_r8
      real(ESMF_KIND_R8)    :: h_r8
      real(ESMF_KIND_R8)    :: m_r8
      real(ESMF_KIND_R8)    :: s_r8
           
      ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL

      ! Parse string into values for each time unit
      call ESMF_ParseDurString(timeintervalString, &
           yy_i8=yy_i8, mm_i8=mm_i8, d_i8=d_i8, d_r8=d_r8, &
           h_r8=h_r8, m_r8=m_r8, s_i8=s_i8, s_r8=s_r8, rc=localrc)      
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
           ESMF_CONTEXT, rcToReturn=rc)) return
      
      ! Set time interval using time unit values parsed above
      
      ! NOTE: Just use I8 for integer values, since it looks like integer values
      !       are stored that way anyway. Also, for times (h,m,s), it looks like both R8
      !       and I8 are added together, so you can just
      !       use both and whichever isn't needed set to 0.
      !       An R8 can exactly represent an I4, so just use R8 for hours and minutes
      !       where an I4 is all that's available.
      call ESMF_TimeIntervalSetDur(timeinterval, &
           yy_i8=yy_i8, &
           mm_i8=mm_i8, &
           d_i8=d_i8, &
           s_i8=s_i8, &
           d_r8=d_r8, &
           h_r8=h_r8, &
           m_r8=m_r8, &
           s_r8=s_r8, &
           rc=localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
           ESMF_CONTEXT, rcToReturn=rc)) return

      ! Return success
      if (present(rc)) rc = ESMF_SUCCESS
      end subroutine ESMF_TimeIntervalSetStr