!--------------------------------------------------------!
!$BI=Bj(B: $B;~4V(B
!$BMzNr(B: 2003/09/10
!--------------------------------------------------------!

subroutine TIME_ini(KT,        & !I
  &  IDATE)                      !IO 

! $BLr3d(B
! $B@QJ,3+;O;~9o(B($BG/(B)$B$N@_Dj(B
!   - $B%j%9%?!<%H%U%!%$%k$+$i3+;O;~9o$r;XDj(B
! loop $B2s?t$N@_Dj(B
  use prm,     only: dt
  use prmphys, only: s_a

  implicit none

  integer, INTENT(IN)   :: KT

  integer, INTENT(INOUT):: IDATE 

  if(IDATE == -1)then
     write(6, *) 'TIME is initial'
     IDATE = 0 
  else
!     write(6, *)'IDATE=', IDATE, 'integral time =' , KT
     IDATE  = IDATE + KT                     ! $B$3$l$+$i$N@QJ,3+;O;~9o(B
     write(6, *)'IDATE=', IDATE
  end if


end subroutine TIME_ini

subroutine TIME_step(IDATE, it, KT)
  use prm,     only: dt
  use prmphys, only: s_a
  
  implicit none

  integer, INTENT(IN)     :: IDATE
  integer, INTENT(IN)     :: it
  integer, INTENT(INOUT)  :: KT
  integer                 :: TIME

  TIME = IDATE + INT(it * dt/s_a)
  KT = it * dt/s_a
  if(MOD(TIME, 50) == 0 )then
     write(6, *)'present time is  ', TIME, ' integral year is', KT
  end if



end subroutine TIME_step


