ESMF_TimePrint Subroutine

public subroutine ESMF_TimePrint(time, keywordEnforcer, options, preString, unit, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Time), intent(in) :: time
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
character(len=*), intent(in), optional :: options
character(len=*), intent(in), optional :: preString
character(len=*), intent(out), optional :: unit
integer, intent(out), optional :: rc

Calls

proc~~esmf_timeprint~~CallsGraph proc~esmf_timeprint ESMF_TimePrint c_esmc_timeprint c_esmc_timeprint proc~esmf_timeprint->c_esmc_timeprint proc~esmf_imerrs ESMF_IMErrS proc~esmf_timeprint->proc~esmf_imerrs proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_timeprint->proc~esmf_logfounderror proc~esmf_timeget ESMF_TimeGet proc~esmf_timeprint->proc~esmf_timeget proc~esmf_timegetinit ESMF_TimeGetInit proc~esmf_timeprint->proc~esmf_timegetinit proc~esmf_utiliounitflush ESMF_UtilIOUnitFlush proc~esmf_timeprint->proc~esmf_utiliounitflush proc~esmf_imerrs->proc~esmf_logfounderror proc~esmf_initcheckshallow ESMF_InitCheckShallow proc~esmf_imerrs->proc~esmf_initcheckshallow 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_timeget->proc~esmf_imerrs proc~esmf_timeget->proc~esmf_logfounderror proc~esmf_timeget->proc~esmf_timegetinit c_esmc_timeget c_esmc_timeget proc~esmf_timeget->c_esmc_timeget proc~esmf_calendarsetinitcreated ESMF_CalendarSetInitCreated proc~esmf_timeget->proc~esmf_calendarsetinitcreated proc~esmf_timeinit ESMF_TimeInit proc~esmf_timeget->proc~esmf_timeinit proc~esmf_timeintervalinit ESMF_TimeIntervalInit proc~esmf_timeget->proc~esmf_timeintervalinit c_esmc_loggeterrormsg c_esmc_loggeterrormsg proc~esmf_logrc2msg->c_esmc_loggeterrormsg proc~esmf_logwrite->proc~esmf_utiliounitflush 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_utilstring2array ESMF_UtilString2Array proc~esmf_logwrite->proc~esmf_utilstring2array 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_timeprint~~CalledByGraph proc~esmf_timeprint ESMF_TimePrint proc~esmf_clockprint ESMF_ClockPrint proc~esmf_clockprint->proc~esmf_timeprint proc~finalize Finalize proc~finalize->proc~esmf_timeprint proc~finalize~2 Finalize proc~finalize~2->proc~esmf_timeprint proc~initializeipdv01p5 InitializeIPDv01p5 proc~initializeipdv01p5->proc~esmf_timeprint proc~initializeipdv03p1 InitializeIPDv03p1 proc~initializeipdv03p1->proc~esmf_timeprint proc~initializeipdv05p1 InitializeIPDv05p1 proc~initializeipdv05p1->proc~esmf_timeprint proc~initializeipdv05p2a InitializeIPDv05p2a proc~initializeipdv05p2a->proc~esmf_timeprint proc~initializeipdv05p2b InitializeIPDv05p2b proc~initializeipdv05p2b->proc~esmf_timeprint proc~initializeipdv05p3 InitializeIPDv05p3 proc~initializeipdv05p3->proc~esmf_timeprint proc~initializeipdv05p4 InitializeIPDv05p4 proc~initializeipdv05p4->proc~esmf_timeprint proc~initializeipdv05p5 InitializeIPDv05p5 proc~initializeipdv05p5->proc~esmf_timeprint proc~initializeipdv05p6a InitializeIPDv05p6a proc~initializeipdv05p6a->proc~esmf_timeprint proc~initializeipdv05p6b InitializeIPDv05p6b proc~initializeipdv05p6b->proc~esmf_timeprint proc~initializeipdvxp01 InitializeIPDvXp01 proc~initializeipdvxp01->proc~esmf_timeprint proc~initializeipdvxp02 InitializeIPDvXp02 proc~initializeipdvxp02->proc~esmf_timeprint proc~initializeipdvxp04 InitializeIPDvXp04 proc~initializeipdvxp04->proc~esmf_timeprint proc~initializeipdvxp05 InitializeIPDvXp05 proc~initializeipdvxp05->proc~esmf_timeprint proc~initializeipdvxp06 InitializeIPDvXp06 proc~initializeipdvxp06->proc~esmf_timeprint proc~initializeipdvxp07 InitializeIPDvXp07 proc~initializeipdvxp07->proc~esmf_timeprint proc~initializeipdvxp08 InitializeIPDvXp08 proc~initializeipdvxp08->proc~esmf_timeprint proc~initializep0 InitializeP0 proc~initializep0->proc~esmf_timeprint proc~initializep0~2 InitializeP0 proc~initializep0~2->proc~esmf_timeprint proc~routine_run routine_Run proc~routine_run->proc~esmf_timeprint proc~run Run proc~run->proc~esmf_timeprint program~esmf_nuopc_utest ESMF_NUOPC_UTest program~esmf_nuopc_utest->proc~esmf_timeprint program~esmf_timeex ESMF_TimeEx program~esmf_timeex->proc~esmf_timeprint

Source Code

      subroutine ESMF_TimePrint(time, keywordEnforcer, options, preString, unit, rc)

! !ARGUMENTS:
      type(ESMF_Time),   intent(in)            :: time
      type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      character (len=*), intent(in),  optional :: options
      character(*),      intent(in),  optional :: preString
      character(*),      intent(out), optional :: unit
      integer,           intent(out), optional :: rc

!
! !DESCRIPTION:
!     Prints out the contents of an {\tt ESMF\_Time} to {\tt stdout}, in
!     support of testing and debugging.  The options control the type of
!     information and level of detail.  For options "string" and "string
!     isofrac", YYYY format returns at least 4 digits; years <= 999 are
!     padded on the left with zeroes and years >= 10000 return the number
!     of digits required. \\
!
!     The arguments are:
!     \begin{description}
!     \item[time]
!          The {\tt ESMF\_Time} to be printed out.
!     \item[{[options]}]
!          Print options. If none specified, prints all Time property values. \\
!          "string" - prints {\tt time}'s value in ISO 8601 format for all units
!                     through seconds.  For any non-zero fractional seconds,
!                     prints in integer rational fraction form n/d.  Format is
!                     YYYY-MM-DDThh:mm:ss[:n/d], where [:n/d] is the 
!                     integer numerator and denominator of the fractional
!                     seconds value, if present.  See ~\cite{ISO} and
!                     ~\cite{ISOnotes}.  See also method
!                     {\tt ESMF\_TimeGet(..., timeString= , ...)} \\
!          "string isofrac" - prints {\tt time}'s value in strict ISO 8601
!                     format for all units, including any fractional seconds
!                     part.  Format is YYYY-MM-DDThh:mm:ss[.f] where [.f]
!                     represents fractional seconds in decimal form, if present.
!                     See ~\cite{ISO} and ~\cite{ISOnotes}.  See also method
!                     {\tt ESMF\_TimeGet(..., timeStringISOFrac= , ...)} \\
!     \item[{[preString]}]
!          Optionally prepended string. Default to empty string.
!     \item[{[unit]}]
!          Internal unit, i.e. a string. Default to printing to stdout.
!     \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 :: yy, mm, dd, h, m, s, ms
      logical :: underscore

      ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL
   
      ! check input
      ESMF_INIT_CHECK_SHALLOW(ESMF_TimeGetInit,time,rc)

      underscore = .false.
      if (present(options)) then
        if (trim(options)=="underscore") underscore = .true.
      endif

      if (present(unit).or.present(preString)) then
        ! simple, single line print format
        call ESMF_TimeGet(time, yy=yy, mm=mm, dd=dd, h=h, m=m, s=s, ms=ms, &
          rc=localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
        if (present(unit)) then
          if (underscore) then
            if (present(preString)) then
              write (unit, "(A, '_', I4.4, '_', I2.2, '_', I2.2, '_', I2.2, "//&
                "'_', I2.2, '_', I2.2, '_', I3.3)") preString, &
                yy, mm, dd, h, m, s, ms
            else
              write (unit, "(I4.4, '_', I2.2, '_', I2.2, '_', I2.2, "//&
                "'_', I2.2, '_', I2.2, '_', I3.3)") &
                yy, mm, dd, h, m, s, ms
            endif
          else
            if (present(preString)) then
              write (unit, "(A, I4, I3, I3, I3, I3, I3, I4)") preString, &
                yy, mm, dd, h, m, s, ms
            else
              write (unit, "(I4, I3, I3, I3, I3, I3, I4)") &
                yy, mm, dd, h, m, s, ms
            endif
          endif
        else
          if (present(preString)) then
            write (*, "(A, I4, I3, I3, I3, I3, I3, I4)") preString, &
              yy, mm, dd, h, m, s, ms
          else
            ! cannot really reach this branch -> cover this by the deeper
            ! implementation in the bigger else block below.
            write (*, "(I4, I3, I3, I3, I3, I3, I4)") &
              yy, mm, dd, h, m, s, ms
          endif
        endif        
      else
        ! print to STDOUT
        
        ! invoke C to C++ entry point
        call ESMF_UtilIOUnitFlush (ESMF_UtilIOStdout, rc=localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

        call c_ESMC_TimePrint(time, options, localrc)
        if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
          ESMF_CONTEXT, rcToReturn=rc)) return
      endif

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