ESMF_ClockGet Subroutine

public subroutine ESMF_ClockGet(clock, keywordEnforcer, timeStep, startTime, stopTime, runDuration, runTimeStepCount, refTime, currTime, prevTime, currSimTime, prevSimTime, calendar, calkindflag, timeZone, advanceCount, alarmCount, direction, name, rc)

Arguments

Type IntentOptional Attributes Name
type(ESMF_Clock), intent(in) :: clock
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
type(ESMF_TimeInterval), intent(out), optional :: timeStep
type(ESMF_Time), intent(out), optional :: startTime
type(ESMF_Time), intent(out), optional :: stopTime
type(ESMF_TimeInterval), intent(out), optional :: runDuration
real(kind=ESMF_KIND_R8), intent(out), optional :: runTimeStepCount
type(ESMF_Time), intent(out), optional :: refTime
type(ESMF_Time), intent(out), optional :: currTime
type(ESMF_Time), intent(out), optional :: prevTime
type(ESMF_TimeInterval), intent(out), optional :: currSimTime
type(ESMF_TimeInterval), intent(out), optional :: prevSimTime
type(ESMF_Calendar), intent(out), optional :: calendar
type(ESMF_CalKind_Flag), intent(out), optional :: calkindflag
integer, intent(out), optional :: timeZone
integer(kind=ESMF_KIND_I8), intent(out), optional :: advanceCount
integer, intent(out), optional :: alarmCount
type(ESMF_Direction_Flag), intent(out), optional :: direction
character(len=*), intent(out), optional :: name
integer, intent(out), optional :: rc

Source Code

      subroutine ESMF_ClockGet(clock, keywordEnforcer, &
        timeStep, startTime, stopTime, &
        runDuration, runTimeStepCount, refTime, currTime, prevTime, &
        currSimTime, prevSimTime, calendar, calkindflag, timeZone, &
        advanceCount, alarmCount, direction, name, rc)

! !ARGUMENTS:
      type(ESMF_Clock),        intent(in)            :: clock
      type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      type(ESMF_TimeInterval), intent(out), optional :: timeStep
      type(ESMF_Time),         intent(out), optional :: startTime
      type(ESMF_Time),         intent(out), optional :: stopTime
      type(ESMF_TimeInterval), intent(out), optional :: runDuration
      real(ESMF_KIND_R8),      intent(out), optional :: runTimeStepCount
      type(ESMF_Time),         intent(out), optional :: refTime
      type(ESMF_Time),         intent(out), optional :: currTime
      type(ESMF_Time),         intent(out), optional :: prevTime
      type(ESMF_TimeInterval), intent(out), optional :: currSimTime
      type(ESMF_TimeInterval), intent(out), optional :: prevSimTime
      type(ESMF_Calendar),     intent(out), optional :: calendar
      type(ESMF_CalKind_Flag), intent(out), optional :: calkindflag
      integer,                 intent(out), optional :: timeZone
      integer(ESMF_KIND_I8),   intent(out), optional :: advanceCount
      integer,                 intent(out), optional :: alarmCount
      type(ESMF_Direction_Flag),    intent(out), optional :: direction
      character (len=*),       intent(out), optional :: name
      integer,                 intent(out), optional :: rc

!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
!     Gets one or more of the properties of an {\tt ESMF\_Clock}.
!
!     The arguments are:
!     \begin{description}
!     \item[clock]
!          The object instance to query.
!     \item[{[timeStep]}]
!          The {\tt ESMF\_Clock}'s time step interval.
!     \item[{[startTime]}]
!          The {\tt ESMF\_Clock}'s starting time.
!     \item[{[stopTime]}]
!          The {\tt ESMF\_Clock}'s stopping time.
!     \item[{[runDuration]}]
!          Alternative way to get {\tt ESMF\_Clock}'s stopping time;
!             runDuration = stopTime - startTime.
!     \item[{[runTimeStepCount]}]
!          Alternative way to get {\tt ESMF\_Clock}'s stopping time;
!             runTimeStepCount = (stopTime - startTime) / timeStep.
!     \item[{[refTime]}]
!          The {\tt ESMF\_Clock}'s reference time.
!     \item[{[currTime]}]
!          The {\tt ESMF\_Clock}'s current time.
!     \item[{[prevTime]}]
!          The {\tt ESMF\_Clock}'s previous time.  Equals currTime at
!          the previous time step.
!     \item[{[currSimTime]}]
!          The current simulation time (currTime - refTime).
!     \item[{[prevSimTime]}]
!          The previous simulation time.  Equals currSimTime at
!          the previous time step.
!     \item[{[calendar]}]
!          The {\tt Calendar} on which all the {\tt Clock}'s times are defined.
!     \item[{[calkindflag]}]
!          The {\tt CalKind\_Flag} on which all the {\tt Clock}'s times are
!          defined.
!     \item[{[timeZone]}]
!          The timezone within which all the {\tt Clock}'s times are defined.
!     \item[{[advanceCount]}]
!          \begin{sloppypar}
!          The number of times the {\tt ESMF\_Clock} has been advanced.
!          Increments in {\tt ESMF\_DIRECTION\_FORWARD} and decrements in
!          {\tt ESMF\_DIRECTION\_REVERSE}; see "direction" argument below and
!          in {\tt ESMF\_ClockSet()}.
!          \end{sloppypar}
!     \item[{[alarmCount]}]
!          The number of {\tt ESMF\_Alarm}s in the {\tt ESMF\_Clock}'s
!          {\tt ESMF\_Alarm} list.
!     \item[{[direction]}]
!          The {\tt ESMF\_Clock}'s time stepping direction.  See also
!          {\tt ESMF\_ClockIsReverse()}, an alternative for convenient use in
!          "if" and "do while" constructs.
!     \item[{[name]}]
!          The name of this clock.
!     \item[{[rc]}]
!          Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!EOP
! !REQUIREMENTS:
!     TMG3.5.1 - TMG3.5.5

      ! temp name for C++ to fill
      character (len=ESMF_MAXSTR) :: tempName

      ! initialize name lengths to zero for non-existent name
      integer :: nameLen, tempNameLen
      integer :: localrc                        ! local return code

      ! Assume failure until success
      if (present(rc)) rc = ESMF_RC_NOT_IMPL
      localrc = ESMF_RC_NOT_IMPL

      nameLen = 0
      tempNameLen = 0

      ! check input
      ESMF_INIT_CHECK_DEEP(ESMF_ClockGetInit,clock,rc)

      ! get length of given name for C++ validation
      if (present(name)) then
        nameLen = len(name)
      end if

      ! invoke C to C++ entry point
      call c_ESMC_ClockGet(clock, nameLen, tempNameLen, tempName, &
                           timeStep, startTime, stopTime, &
                           runDuration, runTimeStepCount, refTime, &
                           currTime, prevTime, currSimTime, prevSimTime, &
                           calendar, calkindflag, timeZone, advanceCount, &
                           alarmCount, direction, localrc)
      if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
        ESMF_CONTEXT, rcToReturn=rc)) return

      ! copy temp name back to given name to restore native Fortran
      !   storage style
      if (present(name)) then
        name = tempName(1:tempNameLen)
      endif

      ! mark outputs as successfully initialized
      call ESMF_TimeIntervalInit(timeStep)
      call ESMF_TimeInit(startTime)
      call ESMF_TimeInit(stopTime)
      call ESMF_TimeIntervalInit(runDuration)
      call ESMF_TimeInit(refTime)
      call ESMF_TimeInit(currTime)
      call ESMF_TimeInit(prevTime)
      call ESMF_TimeIntervalInit(currSimTime)
      call ESMF_TimeIntervalInit(prevSimTime)
      call ESMF_CalendarSetInitCreated(calendar)

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