Index: calendr.F
===================================================================
RCS file: /fs/cgd/csm/models/CVS.REPOS/shared/ccmlsm/calendr.F,v
retrieving revision 1.5
retrieving revision 1.2
diff -c -r1.5 -r1.2
*** calendr.F	1998/09/14 20:46:44	1.5
--- calendr.F	1997/09/16 17:33:38	1.2
***************
*** 29,36 ****
  !
  !-----------------------------------------------------------------------
  !
! ! $Id: CCMPR17.patch,v 1.1 1998/09/14 22:31:41 erik Exp $
! ! $Author: erik $
  !
        implicit none
  !
--- 29,36 ----
  !
  !-----------------------------------------------------------------------
  !
! ! $Id: CCMPR17.patch,v 1.1 1998/09/14 22:31:41 erik Exp $
! ! $Author: erik $
  !
        implicit none
  !
***************
*** 53,60 ****
  !
  !---------------------------Local workspace-----------------------------
  !
!       integer*8 nstep8     ! current time step (0, 1, ...)
!       integer*8 nsecs      ! run time in seconds
        integer ndays        ! ndays + nyears = number of day changes since start
        integer nyears       ! ndays + nyears = number of day changes since start
        integer mcyear       ! current year of current date (0-99)
--- 53,59 ----
  !
  !---------------------------Local workspace-----------------------------
  !
!       integer nsecs        ! run time in seconds
        integer ndays        ! ndays + nyears = number of day changes since start
        integer nyears       ! ndays + nyears = number of day changes since start
        integer mcyear       ! current year of current date (0-99)
***************
*** 65,72 ****
        integer mbday        ! base day of base date (1-31) validity check
        integer ndm(12)      ! number of days per month
        integer jdcon(12)    ! convert month index to julian day
-       integer*8 nspdy      ! number of seconds per day
-       parameter (nspdy=86400)
  !
        save ndm,jdcon
        data ndm/31,28,31,30,31,30,31,31,30,31,30,31/
--- 64,69 ----
***************
*** 74,81 ****
  !
  !-----------------------------------------------------------------------
  !
-       nstep8 = nstep
- !
  ! Check validity of input data
  !
        mbmnth = mod(mbdate,10000)/100
--- 71,76 ----
***************
*** 88,123 ****
          write(6,*)' CALENDR: Invalid base day of base date input:',mbday
          call endrun
        end if
!       if (msbase.lt.0 .or. msbase.ge.nspdy) then
          write(6,*)' CALENDR: Invalid base seconds(msbase):',msbase
          call endrun
        end if
!       if (mbsec.lt.0 .or. mbsec.ge.nspdy) then
          write(6,*)' CALENDR: Invalid base seconds(mbsec):',mbsec
          call endrun
        end if
  !
!       nsecs = nstep8*nint(dtime)
  !
  ! First: current day, seconds
  !
!       mdcur = mdbase + (nsecs+msbase)/nspdy
!       mscur = mod((nsecs+msbase),nspdy)
  !
  ! Next: current date, seconds.
  ! Uncommenting the next line will have the effect of modifying  
  ! nsecs to include base day and base seconds.  This is the way             
  ! the current date was computed in CCM1.
  !
! !      nsecs = nsecs + mdbase*nspdy + msbase
  
!       ndays = (nsecs+mbsec)/nspdy
        nyears = ndays/365
        ndays = mod(ndays,365)
  !
  ! Current seconds of current date
  !
!       mcsec = mod(nsecs+mbsec,nspdy)
  !
  ! Initialize current year, month, day.
  !
--- 83,118 ----
          write(6,*)' CALENDR: Invalid base day of base date input:',mbday
          call endrun
        end if
!       if (msbase.lt.0 .or. msbase.ge.86400) then
          write(6,*)' CALENDR: Invalid base seconds(msbase):',msbase
          call endrun
        end if
!       if (mbsec.lt.0 .or. mbsec.ge.86400) then
          write(6,*)' CALENDR: Invalid base seconds(mbsec):',mbsec
          call endrun
        end if
  !
!       nsecs = nstep*nint(dtime)
  !
  ! First: current day, seconds
  !
!       mdcur = mdbase + (nsecs+msbase)/86400
!       mscur = mod((nsecs+msbase),86400)
  !
  ! Next: current date, seconds.
  ! Uncommenting the next line will have the effect of modifying  
  ! nsecs to include base day and base seconds.  This is the way             
  ! the current date was computed in CCM1.
  !
! !      nsecs = nsecs + mdbase*86400 + msbase
  
!       ndays = (nsecs+mbsec)/86400
        nyears = ndays/365
        ndays = mod(ndays,365)
  !
  ! Current seconds of current date
  !
!       mcsec = mod(nsecs+mbsec,86400)
  !
  ! Initialize current year, month, day.
  !
***************
*** 139,150 ****
        end if
        mcdate = mcyear*10000 + mcmnth*100 + mcday
  !
! ! Convert current month, day, seconds to Julian day + fraction.  Multiply
! ! nspdy by floating point 1 in order to ensure real*8 arithmetic.  As of
! ! 9/14/98 this only makes a difference on Linux.
  !
        jday = jdcon(mcmnth) + mcday
!       calday = float(jday) + float(mcsec)/(1.*nspdy)
  
        return
        end
--- 134,143 ----
        end if
        mcdate = mcyear*10000 + mcmnth*100 + mcday
  !
! ! Convert current month, day, seconds to Julian day + fraction
  !
        jday = jdcon(mcmnth) + mcday
!       calday = float(jday) + float(mcsec)/86400.
  
        return
        end
