subroutine ESMF_TimeSetDefault(time, keywordEnforcer, &
yy, yy_i8, &
mm, dd, &
d, d_i8, &
h, m, &
s, s_i8, &
ms, us, ns, &
d_r8, h_r8, m_r8, s_r8, &
ms_r8, us_r8, ns_r8, &
sN, sN_i8, sD, sD_i8, &
calendar, calkindflag, &
timeZone, rc)
! !ARGUMENTS:
type(ESMF_Time), intent(inout) :: time
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
integer(ESMF_KIND_I4), intent(in), optional :: yy
integer(ESMF_KIND_I8), intent(in), optional :: yy_i8
integer, intent(in), optional :: mm
integer, intent(in), optional :: dd
integer(ESMF_KIND_I4), intent(in), optional :: d
integer(ESMF_KIND_I8), intent(in), optional :: d_i8
integer(ESMF_KIND_I4), intent(in), optional :: h
integer(ESMF_KIND_I4), intent(in), optional :: m
integer(ESMF_KIND_I4), intent(in), optional :: s
integer(ESMF_KIND_I8), intent(in), optional :: s_i8
integer(ESMF_KIND_I4), intent(in), optional :: ms
integer(ESMF_KIND_I4), intent(in), optional :: us
integer(ESMF_KIND_I4), intent(in), optional :: ns
real(ESMF_KIND_R8), intent(in), optional :: d_r8
real(ESMF_KIND_R8), intent(in), optional :: h_r8
real(ESMF_KIND_R8), intent(in), optional :: m_r8
real(ESMF_KIND_R8), intent(in), optional :: s_r8
real(ESMF_KIND_R8), intent(in), optional :: ms_r8
real(ESMF_KIND_R8), intent(in), optional :: us_r8
real(ESMF_KIND_R8), intent(in), optional :: ns_r8
integer(ESMF_KIND_I4), intent(in), optional :: sN
integer(ESMF_KIND_I8), intent(in), optional :: sN_i8
integer(ESMF_KIND_I4), intent(in), optional :: sD
integer(ESMF_KIND_I8), intent(in), optional :: sD_i8
type(ESMF_Calendar), intent(in), optional :: calendar
type(ESMF_CalKind_Flag), intent(in), optional :: calkindflag
integer, intent(in), optional :: timeZone ! not imp
integer, intent(out), optional :: rc
!
! !STATUS:
! \begin{itemize}
! \item\apiStatusCompatibleVersion{5.2.0r}
! \end{itemize}
!
! !DESCRIPTION:
! Initializes an {\tt ESMF\_Time} with a set of user-specified units
! via Fortran optional arguments.
!
! The range of valid values for mm and dd depend on the calendar used.
! For Gregorian, Julian, and No-Leap calendars, mm is [1-12] and dd is
! [1-28,29,30, or 31], depending on the value of mm and whether yy or
! yy\_i8 is a leap year. For the 360-day calendar, mm is [1-12] and dd is
! [1-30]. For Julian Day, Modified Julian Day, and No-Calendar,
! yy, yy\_i8, mm, and dd are invalid inputs, since these calendars do not
! define them. When valid, the yy and yy\_i8 arguments should be fully
! specified, e.g. 2003 instead of 03. yy and yy\_i8 ranges are only
! limited by machine word size, except for the Gregorian and Julian
! calendars, where the lowest (proleptic) date limits are 3/1/-4800 and
! 3/1/-4712, respectively. This is a limitation of the Gregorian
! date-to-Julian day and Julian date-to-Julian day conversion algorithms
! used to convert Gregorian and Julian dates to the internal representation
! of seconds. See~\cite{Fli68} for a description of the Gregorian
! date-to-Julian day algorithm and~\cite{Hat84} for a description of the
! Julian date-to-Julian day algorithm. The Custom calendar will have
! user-defined values for yy, yy\_i8, mm, and dd.
!
! The Julian day specifier, d or d\_i8, can only be used with the
! Julian Day and Modified Julian Day calendars, and has a valid range
! depending on the word size. For a signed 32-bit d, the range for
! Julian day is [+/- 24855]. For a signed 64-bit d\_i8, the valid
! range for Julian day is [+/- 106,751,991,167,300]. The Julian day
! number system adheres to the conventional standard where the reference
! day of d=0 corresponds to 11/24/-4713 in the proleptic Gregorian calendar
! and 1/1/-4712 in the proleptic Julian calendar. See~\cite{Meyer2} and
! ~\cite{JDNcalculator}.
!
! The Modified Julian Day system, introduced by space scientists in the late
! 1950's, is defined as Julian Day - 2400000.5. See~\cite{MJD}.
!
! Note that d and d\_i8 are not valid for the No-Calendar. To remain
! consistent with non-Earth calendars added to ESMF in the future, ESMF
! requires a calendar to be planet-specific. Hence the No-Calendar does
! not know what a day is; it cannot assume an Earth day of 86400 seconds.
!
! Hours, minutes, seconds, and sub-seconds can be used with any calendar,
! since they are standardized units that are the same for any planet.
!
! Time manager represents and manipulates time internally with integers
! to maintain precision. Hence, user-specified floating point values are
! converted internally to integers. Sub-second values are represented
! internally with an integer numerator and denominator fraction (sN/sD).
! The smallest required resolution is nanoseconds (denominator).
! For example, pi can be represented as s=3,
! sN=141592654, sD=1000000000. However, via sN\_i8 and sD\_i8, larger
! values can be used. If specifying a constant floating point value, be
! sure to provide at least 16 digits to take full advantage of double
! precision, for example s\_r8=2.718281828459045d0 for 'e' seconds.
!
! The arguments are:
! \begin{description}
! \item[time]
! The object instance to initialize.
! \item[{[yy]}]
! Integer year (32-bit). Default = 0.
! \item[{[yy\_i8]}]
! Integer year (large, 64-bit). Default = 0.
! \item[{[mm]}]
! Integer month. Default = 1.
! \item[{[dd]}]
! Integer day of the month. Default = 1.
! \item[{[d]}]
! Integer Julian Day, or Modified Julian Day (32-bit). Must not be
! specified with Gregorian calendars. Default = 0.
! \item[{[d\_i8]}]
! Integer Julian Day, or Modified Julian Day (large, 64-bit). Must not be
! specified with Gregorian calendars. Default = 0.
! \item[{[h]}]
! Integer hour. Default = 0.
! \item[{[m]}]
! Integer minute. Default = 0.
! \item[{[s]}]
! Integer second (32-bit). Default = 0.
! \item[{[s\_i8]}]
! Integer second (large, 64-bit). Default = 0.
! \item[{[ms]}]
! Integer millisecond. Default = 0.
! \item[{[us]}]
! Integer microsecond. Default = 0.
! \item[{[ns]}]
! Integer nanosecond. Default = 0.
! \item[{[d\_r8]}]
! Double precision day. Default = 0.0.
! \item[{[h\_r8]}]
! Double precision hour. Default = 0.0.
! \item[{[m\_r8]}]
! Double precision minute. Default = 0.0.
! \item[{[s\_r8]}]
! Double precision second. Default = 0.0.
! \item[{[ms\_r8]}]
! Double precision millisecond. Default = 0.0.
! \item[{[us\_r8]}]
! Double precision microsecond. Default = 0.0.
! \item[{[ns\_r8]}]
! Double precision nanosecond. Default = 0.0.
! \item[{[sN]}]
! Integer numerator of fractional second (sN/sD).
! Default = 0.
! \item[{[sN\_i8]}]
! Integer numerator of fractional second (sN\_i8/sD\_i8)
! (large, 64-bit).
! Default = 0.
! \item[{[sD]}]
! Integer denominator of fractional second (sN/sD).
! Default = 1.
! \item[{[sD\_i8]}]
! Integer denominator of fractional second (sN\_i8/sD\_i8)
! (large, 64-bit).
! Default = 1.
! \item[{[calendar]}]
! \begin{sloppypar}
! Associated {\tt Calendar}. Defaults to calendar
! {\tt ESMF\_CALKIND\_NOCALENDAR} or default specified in
! {\tt ESMF\_Initialize()} or {\tt ESMF\_CalendarSetDefault()}.
! Alternate to, and mutually exclusive with, calkindflag
! below. Primarily for specifying a custom calendar kind.
! \end{sloppypar}
! \item[{[calkindflag]}]
! Alternate to, and mutually exclusive with, calendar above. More
! convenient way of specifying a built-in calendar kind.
! \item[{[timeZone]}]
! Associated timezone (hours offset from UTC, e.g. EST = -5).
! Default = 0 (UTC). (Not implemented yet).
! \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
! Assume failure until success
if (present(rc)) rc = ESMF_RC_NOT_IMPL
localrc = ESMF_RC_NOT_IMPL
! check input
ESMF_INIT_CHECK_DEEP(ESMF_CalendarGetInit,calendar,rc)
! use optional args for any subset
call c_ESMC_TimeSet(time, yy, yy_i8, mm, dd, d, d_i8, &
h, m, s, s_i8, ms, us, ns, &
d_r8, h_r8, m_r8, s_r8, ms_r8, us_r8, ns_r8, &
sN, sN_i8, sD, sD_i8, &
calendar, calkindflag, timeZone, localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! mark output variable as successfully initialized
call ESMF_TimeInit(time)
! Return success
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_TimeSetDefault