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