function DCCalConvertToHour1( in_time, in_unit, cal ) result( out_time )
  !
  ! ä»»æ„ã®æ™‚é–“å˜ä½ (æ—¥æ™‚åˆ†ç§’) ã‹ã‚‰ç§’ã¸ã®å˜ä½ã®å¤‰æ›ã‚’è¡Œã„ã¾ã™.
  !
  ! æ™‚é–“ã®å˜ä½ã¨ã—ã¦æœ‰åŠ¹ãªæ–‡å—åˆ—ã«ã¤ã„ã¦ã¯ä»¥ä¸‹ã‚’å‚ç…§ä¸‹ã•ã„.
  !
  ! dc_calendar_types#UNIT_SEC          :: ç§’ã®å˜ä½
  ! dc_calendar_types#UNIT_MIN          :: åˆ†ã®å˜ä½
  ! dc_calendar_types#UNIT_HOUR         :: æ™‚é–“ã®å˜ä½
  ! dc_calendar_types#UNIT_DAY          :: æ—¥ã®å˜ä½
  !
  ! çœç•¥å¯èƒ½å¼•æ•° *cal* ãŒçœç•¥ã•ã‚ŒãŸå ´åˆã«ã¯, dc_calendar å†…éƒ¨ã§
  ! ä¿æŒã•ã‚Œã‚‹æš¦ã«é–¢ã™ã‚‹æƒ…å ±ã‚’ç”¨ã„ãŸå˜ä½ã®å¤‰æ›ãŒè¡Œã‚ã‚Œã¾ã™.
  ! *cal* ãŒçœç•¥ã•ã‚Œãªã„å ´åˆã«ã¯ãã®å¤‰æ•°ã«è¨å®šã•ã‚ŒãŸæš¦ã®æƒ…å ±ã‚’
  ! ç”¨ã„ã¦å˜ä½ã®å¤‰æ›ãŒè¡Œã‚ã‚Œã¾ã™.
  !
  ! Convert of unit from arbitrary time units (day, hour, minute, second)
  ! into sec.
  !
  ! Valid strings as units of time are follows.
  !
  ! dc_calendar_types#UNIT_SEC          :: Units of second
  ! dc_calendar_types#UNIT_MIN          :: Units of minute
  ! dc_calendar_types#UNIT_HOUR         :: Units of hour
  ! dc_calendar_types#UNIT_DAY          :: Units of day
  !
  ! If an optional argument *cal* is omitted,
  ! unit is converted with information of a calendar
  ! that is stored in the "dc_calendar".
  ! If *cal* is not omitted, unit is converted with information of the variable.
  !
  use dc_calendar_internal, only: default_cal, default_cal_set, &
    & dccaltype_str, dccaldate_str2usym
  use dc_calendar_types, only: DC_CAL, &
    & UNIT_SYMBOL_YEAR, UNIT_SYMBOL_MONTH, UNIT_SYMBOL_DAY, &
    & UNIT_SYMBOL_HOUR, UNIT_SYMBOL_MIN, UNIT_SYMBOL_SEC
  use dc_calendar_generic, only: DCCalConvertByUnit
  use dc_error, only: StoreError, DC_NOERR, DC_EBADUNIT, DC_ENOTINIT
  use dc_message, only: MessageNotify
  use dc_trace, only: BeginSub, EndSub
  use dc_types, only: DP, TOKEN, STRING
  implicit none
  real(DP):: out_time
                              ! å¤‰æ›å¾Œã®æ™‚é–“ã®æ•°å€¤.
                              !
                              ! Numerical value of time after conversion.

  real(DP), intent(in):: in_time
                              ! å¤‰æ›å‰ã®æ™‚é–“ã®æ•°å€¤.
                              !
                              ! Numerical value of time before conversion.
  character(*), intent(in):: in_unit
                              ! å¤‰æ›å‰ã®æ™‚é–“ã®å˜ä½.
                              !
                              ! Units of time before conversion.
  type(DC_CAL), intent(in), optional, target:: cal
                              ! æš¦æƒ…å ±ã‚’åŽã‚ãŸã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆ.
                              !
                              ! An object that stores information of
                              ! calendar.

  ! ä½œæ¥å¤‰æ•°
  ! Work variables
  !
  type(DC_CAL), pointer:: calp =>null()
  integer:: in_unit_sym, out_unit_sym
!!$  integer:: stat
!!$  character(STRING):: cause_c
  character(*), parameter:: subname = 'DCCalConvertToHour1'
continue
!!$  call BeginSub( subname )
!!$  stat = DC_NOERR
!!$  cause_c = ''

  out_time = -1.0

  ! ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆã®ãƒã‚¤ãƒ³ã‚¿å‰²ä»˜
  ! Associate pointer of an object
  !
  if ( present( cal ) ) then
    calp => cal
  else
    calp => default_cal
    if ( .not. calp % initialized ) call default_cal_set
  end if

  ! åˆæœŸè¨å®šã®ãƒã‚§ãƒƒã‚¯
  ! Check initialization
  !
  if ( .not. calp % initialized ) then
    call MessageNotify('W', subname, '"cal" is not initialized. <-1> is returned.' )
!!$    stat = DC_ENOTINIT
!!$    cause_c = 'DC_CAL'
    goto 999
  end if

  ! å˜ä½ã®è§£é‡ˆ
  ! Parse units
  !
  in_unit_sym  = dccaldate_str2usym( in_unit )
  out_unit_sym = UNIT_SYMBOL_HOUR

  ! æ•°å€¤ã®å¤‰æ›
  ! Convert a value
  !
  out_time = DCCalConvertByUnit( in_time, in_unit_sym, out_unit_sym, cal )

  ! çµ‚äº†å‡¦ç†, ä¾‹å¤–å‡¦ç†
  ! Termination and Exception handling
  !
999 continue
  nullify( calp )
!!$  call StoreError( stat, subname, err, cause_c )
!!$  call EndSub( subname )
end function DCCalConvertToHour1

!---------------------------------------------------------------------

function DCCalConvertToHour2( in_time, in_unit, cal ) result( out_time )
  !
  ! ä»»æ„ã®æ™‚é–“å˜ä½ (æ—¥æ™‚åˆ†ç§’) ã‹ã‚‰ç§’ã¸ã®å˜ä½ã®å¤‰æ›ã‚’è¡Œã„ã¾ã™.
  !
  ! æ™‚é–“ã®å˜ä½ã¨ã—ã¦æœ‰åŠ¹ãªæ•´æ•°åž‹å¤‰æ•°ã«ã¤ã„ã¦ã¯ä»¥ä¸‹ã‚’å‚ç…§ä¸‹ã•ã„.
  ! å˜ä½ã¨ã—ã¦æ•´æ•°å€¤ã‚’ç›´æŽ¥ä¸Žãˆã‚‹ã“ã¨ã¯ã›ãš, ä»¥ä¸‹ã®å¤‰æ•°ã‚’
  ! ä¸Žãˆã¦ãã ã•ã„.
  !
  ! dc_calendar_types#UNIT_SYMBOL_SEC          :: ç§’ã®å˜ä½
  ! dc_calendar_types#UNIT_SYMBOL_MIN          :: åˆ†ã®å˜ä½
  ! dc_calendar_types#UNIT_SYMBOL_HOUR         :: æ™‚é–“ã®å˜ä½
  ! dc_calendar_types#UNIT_SYMBOL_DAY          :: æ—¥ã®å˜ä½
  !
  ! çœç•¥å¯èƒ½å¼•æ•° *cal* ãŒçœç•¥ã•ã‚ŒãŸå ´åˆã«ã¯, dc_calendar å†…éƒ¨ã§
  ! ä¿æŒã•ã‚Œã‚‹æš¦ã«é–¢ã™ã‚‹æƒ…å ±ã‚’ç”¨ã„ãŸå˜ä½ã®å¤‰æ›ãŒè¡Œã‚ã‚Œã¾ã™.
  ! *cal* ãŒçœç•¥ã•ã‚Œãªã„å ´åˆã«ã¯ãã®å¤‰æ•°ã«è¨å®šã•ã‚ŒãŸæš¦ã®æƒ…å ±ã‚’
  ! ç”¨ã„ã¦å˜ä½ã®å¤‰æ›ãŒè¡Œã‚ã‚Œã¾ã™.
  !
  ! Convert of unit from arbitrary time units (day, hour, minute, second)
  ! into sec.
  !
  ! Valid integer variables as units of time are follows.
  ! Do not specify integer directly, but specify following variables.
  !
  ! dc_calendar_types#UNIT_SYMBOL_SEC          :: Units of second
  ! dc_calendar_types#UNIT_SYMBOL_MIN          :: Units of minute
  ! dc_calendar_types#UNIT_SYMBOL_HOUR         :: Units of hour
  ! dc_calendar_types#UNIT_SYMBOL_DAY          :: Units of day
  !
  ! If an optional argument *cal* is omitted,
  ! unit is converted with information of a calendar
  ! that is stored in the "dc_calendar".
  ! If *cal* is not omitted, unit is converted with information of the variable.
  !
  use dc_calendar_internal, only: default_cal, default_cal_set, &
    & dccaltype_str, dccaldate_str2usym
  use dc_calendar_generic, only: DCCalConvertByUnit
  use dc_calendar_types, only: DC_CAL, &
    & UNIT_SYMBOL_YEAR, UNIT_SYMBOL_MONTH, UNIT_SYMBOL_DAY, &
    & UNIT_SYMBOL_HOUR, UNIT_SYMBOL_MIN, UNIT_SYMBOL_SEC
  use dc_error, only: StoreError, DC_NOERR, DC_EBADUNIT, DC_ENOTINIT
  use dc_message, only: MessageNotify
  use dc_trace, only: BeginSub, EndSub
  use dc_types, only: DP, TOKEN, STRING
  implicit none
  real(DP):: out_time
                              ! å¤‰æ›å¾Œã®æ™‚é–“ã®æ•°å€¤.
                              !
                              ! Numerical value of time after conversion.
  real(DP), intent(in):: in_time
                              ! å¤‰æ›å‰ã®æ™‚é–“ã®æ•°å€¤.
                              !
                              ! Numerical value of time before conversion.
  integer, intent(in):: in_unit
                              ! å¤‰æ›å‰ã®æ™‚é–“ã®å˜ä½.
                              !
                              ! Units of time before conversion.
  type(DC_CAL), intent(in), optional, target:: cal
                              ! æš¦æƒ…å ±ã‚’åŽã‚ãŸã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆ.
                              !
                              ! An object that stores information of
                              ! calendar.

  ! ä½œæ¥å¤‰æ•°
  ! Work variables
  !
  type(DC_CAL), pointer:: calp =>null()
  integer:: out_unit
                              ! å¤‰æ›å¾Œã®æ™‚é–“ã®å˜ä½.
                              !
                              ! Units of time after conversion.

!!$  integer:: stat
!!$  character(STRING):: cause_c
  character(*), parameter:: subname = 'DCCalConvertToHour2'
continue
!!$  call BeginSub( subname )
!!$  stat = DC_NOERR
!!$  cause_c = ''

  out_time = -1.0

  ! ã‚ªãƒ–ã‚¸ã‚§ã‚¯ãƒˆã®ãƒã‚¤ãƒ³ã‚¿å‰²ä»˜
  ! Associate pointer of an object
  !
  if ( present( cal ) ) then
    calp => cal
  else
    calp => default_cal
    if ( .not. calp % initialized ) call default_cal_set
  end if

  ! åˆæœŸè¨å®šã®ãƒã‚§ãƒƒã‚¯
  ! Check initialization
  !
  if ( .not. calp % initialized ) then
    call MessageNotify('W', subname, '"cal" is not initialized. <-1> is returned.' )
!!$    stat = DC_ENOTINIT
!!$    cause_c = 'DC_CAL'
    goto 999
  end if

  ! å˜ä½ã®è§£é‡ˆ
  ! Parse units
  !
  out_unit = UNIT_SYMBOL_HOUR

  ! æ•°å€¤ã®å¤‰æ›
  ! Convert a value
  !
  out_time = DCCalConvertByUnit( in_time, in_unit, out_unit, cal )

  ! çµ‚äº†å‡¦ç†, ä¾‹å¤–å‡¦ç†
  ! Termination and Exception handling
  !
999 continue
  nullify( calp )
!!$  call StoreError( stat, subname, err, cause_c )
!!$  call EndSub( subname )
end function DCCalConvertToHour2