Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/CONFIG/SHARED/namelist_ref
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/CONFIG/SHARED/namelist_ref	(revision 15255)
@@ -29,5 +29,4 @@
    nn_itend    =    5475   !  last  time step (std 5475)
    nn_date0    =  010101   !  date at nit_0000 (format yyyymmdd) used if ln_rstart=F or (ln_rstart=T and nn_rstctl=0 or 1)
-   nn_time0    =       0   !  initial time of day in hhmm
    nn_leapy    =       0   !  Leap year calendar (1) or not (0)
    ln_rstart   = .false.   !  start from rest (F) or from a restart file (T)
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/ASM/asminc.F90	(revision 15255)
@@ -41,5 +41,4 @@
 #endif
    USE sbc_oce          ! Surface boundary condition variables.
-   USE diaobs, ONLY: calc_date     ! Compute the calendar date on a given step
 
    IMPLICIT NONE
@@ -47,4 +46,5 @@
    
    PUBLIC   asm_inc_init   !: Initialize the increment arrays and IAU weights
+   PUBLIC   calc_date      !: Compute the calendar date YYYYMMDD on a given step
    PUBLIC   tra_asm_inc    !: Apply the tracer (T and S) increments
    PUBLIC   dyn_asm_inc    !: Apply the dynamic (u and v) increments
@@ -119,9 +119,9 @@
       INTEGER :: iiauper         ! Number of time steps in the IAU period
       INTEGER :: icycper         ! Number of time steps in the cycle
-      REAL(KIND=dp) :: ditend_date     ! Date YYYYMMDD.HHMMSS of final time step
-      REAL(KIND=dp) :: ditbkg_date     ! Date YYYYMMDD.HHMMSS of background time step for Jb term
-      REAL(KIND=dp) :: ditdin_date     ! Date YYYYMMDD.HHMMSS of background time step for DI
-      REAL(KIND=dp) :: ditiaustr_date  ! Date YYYYMMDD.HHMMSS of IAU interval start time step
-      REAL(KIND=dp) :: ditiaufin_date  ! Date YYYYMMDD.HHMMSS of IAU interval final time step
+      INTEGER :: iitend_date     ! Date YYYYMMDD of final time step
+      INTEGER :: iitbkg_date     ! Date YYYYMMDD of background time step for Jb term
+      INTEGER :: iitdin_date     ! Date YYYYMMDD of background time step for DI
+      INTEGER :: iitiaustr_date  ! Date YYYYMMDD of IAU interval start time step
+      INTEGER :: iitiaufin_date  ! Date YYYYMMDD of IAU interval final time step
       !
       REAL(wp) :: znorm        ! Normalization factor for IAU weights
@@ -189,10 +189,10 @@
       iiauper = nitiaufin_r - nitiaustr_r + 1  ! IAU interval length
       icycper = nitend      - nit000      + 1  ! Cycle interval length
-      
-      CALL calc_date( nitend, ditend_date ) ! Date of final time step
-      CALL calc_date( nitbkg_r, ditbkg_date ) ! Background time for Jb referenced to ndate0
-      CALL calc_date( nitdin_r, ditdin_date ) ! Background time for DI referenced to ndate0
-      CALL calc_date( nitiaustr_r, ditiaustr_date ) ! IAU start time referenced to ndate0
-      CALL calc_date( nitiaufin_r, ditiaufin_date ) ! IAU end time referenced to ndate0
+
+      CALL calc_date( nit000, nitend     , ndate0, iitend_date    )     ! Date of final time step
+      CALL calc_date( nit000, nitbkg_r   , ndate0, iitbkg_date    )     ! Background time for Jb referenced to ndate0
+      CALL calc_date( nit000, nitdin_r   , ndate0, iitdin_date    )     ! Background time for DI referenced to ndate0
+      CALL calc_date( nit000, nitiaustr_r, ndate0, iitiaustr_date )     ! IAU start time referenced to ndate0
+      CALL calc_date( nit000, nitiaufin_r, ndate0, iitiaufin_date )     ! IAU end time referenced to ndate0
       !
       IF(lwp) THEN
@@ -210,10 +210,9 @@
          WRITE(numout,*) '       ndastp         = ', ndastp
          WRITE(numout,*) '       ndate0         = ', ndate0
-         WRITE(numout,*) '       nn_time0       = ', nn_time0
-         WRITE(numout,*) '       ditend_date    = ', ditend_date
-         WRITE(numout,*) '       ditbkg_date    = ', ditbkg_date
-         WRITE(numout,*) '       ditdin_date    = ', ditdin_date
-         WRITE(numout,*) '       ditiaustr_date = ', ditiaustr_date
-         WRITE(numout,*) '       ditiaufin_date = ', ditiaufin_date
+         WRITE(numout,*) '       iitend_date    = ', iitend_date
+         WRITE(numout,*) '       iitbkg_date    = ', iitbkg_date
+         WRITE(numout,*) '       iitdin_date    = ', iitdin_date
+         WRITE(numout,*) '       iitiaustr_date = ', iitiaustr_date
+         WRITE(numout,*) '       iitiaufin_date = ', iitiaufin_date
       ENDIF
 
@@ -387,15 +386,15 @@
             WRITE(numout,*) 
             WRITE(numout,*) 'asm_inc_init : Assimilation increments valid ', &
-               &            ' between dates ', z_inc_dateb,' and ',  &
-               &            z_inc_datef
+               &            ' between dates ', NINT( z_inc_dateb ),' and ',  &
+               &            NINT( z_inc_datef )
             WRITE(numout,*) '~~~~~~~~~~~~'
          ENDIF
 
-         IF (     ( z_inc_dateb < ndastp + nn_time0*0.0001_wp ) &
-            & .OR.( z_inc_datef > ditend_date ) ) &
+         IF (     ( NINT( z_inc_dateb ) < ndastp      ) &
+            & .OR.( NINT( z_inc_datef ) > iitend_date ) ) &
             & CALL ctl_warn( ' Validity time of assimilation increments is ', &
             &                ' outside the assimilation interval' )
 
-         IF ( ( ln_asmdin ).AND.( zdate_inc /= ditdin_date ) ) &
+         IF ( ( ln_asmdin ).AND.( NINT( zdate_inc ) /= iitdin_date ) ) &
             & CALL ctl_warn( ' Validity time of assimilation increments does ', &
             &                ' not agree with Direct Initialization time' )
@@ -533,9 +532,9 @@
             WRITE(numout,*) 
             WRITE(numout,*) 'asm_inc_init : Assimilation background state valid at : ', &
-               & zdate_bkg
+               &  NINT( zdate_bkg )
             WRITE(numout,*) '~~~~~~~~~~~~'
          ENDIF
 
-         IF ( zdate_bkg /= ditdin_date ) &
+         IF ( NINT( zdate_bkg ) /= iitdin_date ) &
             & CALL ctl_warn( ' Validity time of assimilation background state does', &
             &                ' not agree with Direct Initialization time' )
@@ -565,4 +564,107 @@
       !
    END SUBROUTINE asm_inc_init
+
+
+   SUBROUTINE calc_date( kit000, kt, kdate0, kdate )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE calc_date  ***
+      !!          
+      !! ** Purpose : Compute the calendar date YYYYMMDD at a given time step.
+      !!
+      !! ** Method  : Compute the calendar date YYYYMMDD at a given time step.
+      !!
+      !! ** Action  : 
+      !!----------------------------------------------------------------------
+      INTEGER, INTENT(IN) :: kit000  ! Initial time step
+      INTEGER, INTENT(IN) :: kt      ! Current time step referenced to kit000
+      INTEGER, INTENT(IN) :: kdate0  ! Initial date
+      INTEGER, INTENT(OUT) :: kdate  ! Current date reference to kdate0
+      !
+      INTEGER :: iyea0    ! Initial year
+      INTEGER :: imon0    ! Initial month
+      INTEGER :: iday0    ! Initial day
+      INTEGER :: iyea     ! Current year
+      INTEGER :: imon     ! Current month
+      INTEGER :: iday     ! Current day
+      INTEGER :: idaystp  ! Number of days between initial and current date
+      INTEGER :: idaycnt  ! Day counter
+
+      INTEGER, DIMENSION(12) ::   imonth_len    !: length in days of the months of the current year
+
+      !-----------------------------------------------------------------------
+      ! Compute the calendar date YYYYMMDD
+      !-----------------------------------------------------------------------
+
+      ! Initial date
+      iyea0 =   kdate0 / 10000
+      imon0 = ( kdate0 - ( iyea0 * 10000 ) ) / 100
+      iday0 =   kdate0 - ( iyea0 * 10000 ) - ( imon0 * 100 ) 
+
+      ! Check that kt >= kit000 - 1
+      IF ( kt < kit000 - 1 ) CALL ctl_stop( ' kt must be >= kit000 - 1')
+
+      ! If kt = kit000 - 1 then set the date to the restart date
+      IF ( kt == kit000 - 1 ) THEN
+
+         kdate = ndastp
+         RETURN
+
+      ENDIF
+
+      ! Compute the number of days from the initial date
+      idaystp = INT( REAL( kt - kit000 ) * rdt / 86400. )
+   
+      iday    = iday0
+      imon    = imon0
+      iyea    = iyea0
+      idaycnt = 0
+
+      CALL calc_month_len( iyea, imonth_len )
+
+      DO WHILE ( idaycnt < idaystp )
+         iday = iday + 1
+         IF ( iday > imonth_len(imon) )  THEN
+            iday = 1
+            imon = imon + 1
+         ENDIF
+         IF ( imon > 12 ) THEN
+            imon = 1
+            iyea = iyea + 1
+            CALL calc_month_len( iyea, imonth_len )  ! update month lengths
+         ENDIF                 
+         idaycnt = idaycnt + 1
+      END DO
+      !
+      kdate = iyea * 10000 + imon * 100 + iday
+      !
+   END SUBROUTINE
+
+
+   SUBROUTINE calc_month_len( iyear, imonth_len )
+      !!----------------------------------------------------------------------
+      !!                    ***  ROUTINE calc_month_len  ***
+      !!          
+      !! ** Purpose : Compute the number of days in a months given a year.
+      !!
+      !! ** Method  : 
+      !!----------------------------------------------------------------------
+      INTEGER, DIMENSION(12) ::   imonth_len    !: length in days of the months of the current year
+      INTEGER :: iyear         !: year
+      !!----------------------------------------------------------------------
+      !
+      ! length of the month of the current year (from nleapy, read in namelist)
+      IF ( nleapy < 2 ) THEN 
+         imonth_len(:) = (/ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 /)
+         IF ( nleapy == 1 ) THEN   ! we are using calendar with leap years
+            IF ( MOD(iyear, 4) == 0 .AND. ( MOD(iyear, 400) == 0 .OR. MOD(iyear, 100) /= 0 ) ) THEN
+               imonth_len(2) = 29
+            ENDIF
+         ENDIF
+      ELSE
+         imonth_len(:) = nleapy   ! all months with nleapy days per year
+      ENDIF
+      !
+   END SUBROUTINE
+
 
    SUBROUTINE tra_asm_inc( kt )
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/BDY/bdytides.F90	(revision 15255)
@@ -325,5 +325,5 @@
       ENDIF
 
-      IF ( (nsec_day == NINT(0.5_wp * rdttra(1)) .OR. kt==nit000) .AND. zflag==1 ) THEN
+      IF ( nsec_day == NINT(0.5_wp * rdttra(1)) .AND. zflag==1 ) THEN
         !
         kt_tide = kt
@@ -436,11 +436,11 @@
             ELSE
                ilen0(:)=nblenrim(:)
-            ENDIF
+            ENDIF     
 
             ! We refresh nodal factors every day below
             ! This should be done somewhere else
-            IF ( ( nsec_day == NINT(0.5_wp * rdttra(1)) .OR. kt==nit000 ) .AND. lk_first_btstp ) THEN
-               !
-               kt_tide = kt - (nsec_day - 0.5_wp * rdttra(1))/rdttra(1)
+            IF ( nsec_day == NINT(0.5_wp * rdttra(1)) .AND. lk_first_btstp ) THEN
+               !
+               kt_tide = kt               
                !
                IF(lwp) THEN
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/daymod.F90	(revision 15255)
@@ -73,9 +73,4 @@
       !!----------------------------------------------------------------------
       !
-      ! max number of seconds between each restart
-      IF( REAL( nitend - nit000 + 1 ) * rdt > REAL( HUGE( nsec1jan000 ) ) ) THEN
-         CALL ctl_stop( 'The number of seconds between each restart exceeds the integer 4 max value: 2^31-1. ',   &
-            &           'You must do a restart at higher frequency (or remove this stop and recompile the code in I8)' )
-      ENDIF
       ! all calendar staff is based on the fact that MOD( rday, rdttra(1) ) == 0
       IF( MOD( rday     , rdttra(1) ) /= 0. )   CALL ctl_stop( 'the time step must devide the number of second of in a day' )
@@ -95,10 +90,7 @@
       nday    =   ndastp - (nyear * 10000) - ( nmonth * 100 )
 
-      nhour   =   nn_time0 / 100
-      nminute = ( nn_time0 - nhour * 100 )
-
-      CALL ymds2ju( nyear, nmonth, nday, nhour*3600._wp+nminute*60._wp, fjulday )  
+      CALL ymds2ju( nyear, nmonth, nday, 0.0, fjulday )  ! we assume that we start run at 00:00
       IF( ABS(fjulday - REAL(NINT(fjulday),wp)) < 0.1 / rday )   fjulday = REAL(NINT(fjulday),wp)   ! avoid truncation error
-      IF(nhour*3600 + nminute*60 - ndt05 .lt. 0)   fjulday = fjulday + 1.                    ! move back to the day at nit000 (and not at nit000 - 1)
+      fjulday = fjulday + 1.                             ! move back to the day at nit000 (and not at nit000 - 1)
 
       nsec1jan000 = 0
@@ -121,27 +113,16 @@
       !compute number of days between last monday and today
       CALL ymds2ju( 1900, 01, 01, 0.0, zjul )  ! compute julian day value of 01.01.1900 (our reference that was a Monday)
-      inbday = FLOOR(fjulday - zjul)            ! compute nb day between  01.01.1900 and start of current day
+      inbday = NINT(fjulday - zjul)            ! compute nb day between  01.01.1900 and current day
       idweek = MOD(inbday, 7)                  ! compute nb day between last monday and current day
-      IF (idweek .lt. 0) idweek=idweek+7       ! Avoid negative values for dates before 01.01.1900
 
       ! number of seconds since the beginning of current year/month/week/day at the middle of the time-step
-      IF (nhour*3600+nminute*60-ndt05 .gt. 0) THEN
-         ! 1 timestep before current middle of first time step is still the same day
-         nsec_year  = (nday_year-1) * nsecd + nhour*3600+nminute*60 - ndt05 
-         nsec_month = (nday-1)      * nsecd + nhour*3600+nminute*60 - ndt05    
-      ELSE
-         ! 1 time step before the middle of the first time step is the previous day 
-         nsec_year  = nday_year * nsecd + nhour*3600+nminute*60 - ndt05 
-         nsec_month = nday      * nsecd + nhour*3600+nminute*60 - ndt05   
-      ENDIF
-      nsec_week  = idweek    * nsecd + nhour*3600+nminute*60 - ndt05
-      nsec_day   =             nhour*3600+nminute*60 - ndt05 
-      IF( nsec_day .lt. 0 ) nsec_day = nsec_day + nsecd
-      IF( nsec_week .lt. 0 ) nsec_week = nsec_week + nsecd*7
+      nsec_year  = nday_year * nsecd - ndt05   ! 1 time step before the middle of the first time step
+      nsec_month = nday      * nsecd - ndt05   ! because day will be called at the beginning of step
+      nsec_week  = idweek    * nsecd - ndt05
+      nsec_day   =             nsecd - ndt05
 
       ! control print
-      IF(lwp) WRITE(numout,'(a,i6,a,i2,a,i2,a,i8,a,i8,a,i8,a,i8)')' =======>> 1/2 time step before the start of the run DATE Y/M/D = ',   &
-           &                   nyear, '/', nmonth, '/', nday, '  nsec_day:', nsec_day, '  nsec_week:', nsec_week, '  &
-           &                   nsec_month:', nsec_month , '  nsec_year:' , nsec_year
+      IF(lwp) WRITE(numout,'(a,i6,a,i2,a,i2,a,i8,a,i8)')' =======>> 1/2 time step before the start of the run DATE Y/M/D = ',   &
+           &                   nyear, '/', nmonth, '/', nday, '  nsec_day:', nsec_day, '  nsec_week:', nsec_week
 
       ! Up to now, calendar parameters are related to the end of previous run (nit000-1)
@@ -257,4 +238,9 @@
                nday_year = 1
                nsec_year = ndt05
+               IF( nsec1jan000 >= 2 * (2**30 - nsecd * nyear_len(1) / 2 ) ) THEN   ! test integer 4 max value
+                  CALL ctl_stop( 'The number of seconds between Jan. 1st 00h of nit000 year and Jan. 1st 00h ',   &
+                     &           'of the current year is exceeding the INTEGER 4 max VALUE: 2^31-1 -> 68.09 years in seconds', &
+                     & 'You must do a restart at higher frequency (or remove this STOP and recompile everything in I8)' )
+               ENDIF
                nsec1jan000 = nsec1jan000 + nsecd * nyear_len(1)
                IF( nleapy == 1 )   CALL day_mth
@@ -316,6 +302,5 @@
       CHARACTER(len=*), INTENT(in) ::   cdrw       ! "READ"/"WRITE" flag
       !
-      REAL(wp) ::   zkt, zndastp, zdayfrac, ksecs, ktime
-      INTEGER  ::   ihour, iminute
+      REAL(wp) ::   zkt, zndastp
       !!----------------------------------------------------------------------
 
@@ -324,7 +309,5 @@
          IF( iom_varid( numror, 'kt', ldstop = .FALSE. ) > 0 ) THEN
             ! Get Calendar informations
-            IF(nn_timing == 2)  CALL timing_start('iom_rstget')
             CALL iom_get( numror, 'kt', zkt )   ! last time-step of previous run
-            IF(nn_timing == 2)  CALL timing_stop('iom_rstget')
             IF(lwp) THEN
                WRITE(numout,*) ' *** Info read in restart : '
@@ -344,49 +327,17 @@
             ! define ndastp and adatrj
             IF ( nrstdt == 2 ) THEN
-               IF(nn_timing == 2)  CALL timing_start('iom_rstget')
                ! read the parameters correspondting to nit000 - 1 (last time step of previous run)
                CALL iom_get( numror, 'ndastp', zndastp )
                ndastp = NINT( zndastp )
                CALL iom_get( numror, 'adatrj', adatrj  )
-	       CALL iom_get( numror, 'ntime', ktime )
-               IF(nn_timing == 2)  CALL timing_stop('iom_rstget')
-	       nn_time0=INT(ktime)
-               ! calculate start time in hours and minutes
-	       zdayfrac=adatrj-INT(adatrj)
-	       ksecs = NINT(zdayfrac*86400)	       ! Nearest second to catch rounding errors in adatrj	       
-	       ihour = INT(ksecs/3600)
-	       iminute = ksecs/60-ihour*60
- 	        
-               ! Add to nn_time0
-               nhour   =   nn_time0 / 100
-               nminute = ( nn_time0 - nhour * 100 )
-	       nminute=nminute+iminute
-	       
-	       IF( nminute >= 60 ) THEN
-	          nminute=nminute-60
-		  nhour=nhour+1
-	       ENDIF
-	       nhour=nhour+ihour
-	       IF( nhour >= 24 ) THEN
-		  nhour=nhour-24
-	          adatrj=adatrj+1
-	       ENDIF	       
-	       nn_time0 = nhour * 100 + nminute
-	       adatrj = INT(adatrj)                    ! adatrj set to integer as nn_time0 updated	       
             ELSE
-               ! parameters corresponding to nit000 - 1 (as we start the step loop with a call to day)
-               ndastp = ndate0        ! ndate0 read in the namelist in dom_nam
-               nhour   =   nn_time0 / 100
-               nminute = ( nn_time0 - nhour * 100 )
-               IF( nhour*3600+nminute*60-ndt05 .lt. 0 )  ndastp=ndastp-1      ! Start hour is specified in the namelist (default 0)
+               ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day)
+               ndastp = ndate0 - 1     ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00
                adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday
                ! note this is wrong if time step has changed during run
             ENDIF
          ELSE
-            ! parameters corresponding to nit000 - 1 (as we start the step loop with a call to day)
-            ndastp = ndate0           ! ndate0 read in the namelist in dom_nam
-            nhour   =   nn_time0 / 100
-            nminute = ( nn_time0 - nhour * 100 )
-            IF( nhour*3600+nminute*60-ndt05 .lt. 0 )  ndastp=ndastp-1      ! Start hour is specified in the namelist (default 0)
+            ! parameters correspondting to nit000 - 1 (as we start the step loop with a call to day)
+            ndastp = ndate0 - 1        ! ndate0 read in the namelist in dom_nam, we assume that we start run at 00:00
             adatrj = ( REAL( nit000-1, wp ) * rdttra(1) ) / rday
          ENDIF
@@ -397,5 +348,4 @@
             WRITE(numout,*) '   date ndastp                                      : ', ndastp
             WRITE(numout,*) '   number of elapsed days since the begining of run : ', adatrj
-            WRITE(numout,*) '   nn_time0                                         : ',nn_time0
             WRITE(numout,*)
          ENDIF
@@ -409,11 +359,8 @@
          ENDIF
          ! calendar control
-         IF(nn_timing == 2)  CALL timing_start('iom_rstput')
          CALL iom_rstput( kt, nitrst, numrow, 'kt'     , REAL( kt    , wp) )   ! time-step
          CALL iom_rstput( kt, nitrst, numrow, 'ndastp' , REAL( ndastp, wp) )   ! date
          CALL iom_rstput( kt, nitrst, numrow, 'adatrj' , adatrj            )   ! number of elapsed days since
          !                                                                     ! the begining of the run [s]
-         CALL iom_rstput( kt, nitrst, numrow, 'ntime'  , REAL( nn_time0, wp) ) ! time
-         IF(nn_timing == 2)  CALL timing_stop('iom_rstput')
       ENDIF
       !
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/dom_oce.F90	(revision 15255)
@@ -277,6 +277,4 @@
    INTEGER , PUBLIC ::   nmonth        !: current month
    INTEGER , PUBLIC ::   nday          !: current day of the month
-   INTEGER , PUBLIC ::   nhour         !: current hour
-   INTEGER , PUBLIC ::   nminute       !: current minute
    INTEGER , PUBLIC ::   ndastp        !: time step date in yyyymmdd format
    INTEGER , PUBLIC ::   nday_year     !: current day counted from jan 1st of the current year
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 15255)
@@ -137,5 +137,5 @@
       NAMELIST/namrun/ cn_ocerst_indir, cn_ocerst_outdir, nn_stocklist, ln_rst_list,               &
          &             nn_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , nn_rstctl,   &
-         &             nn_it000, nn_itend  , nn_date0    ,nn_time0    , nn_leapy     , nn_istate , nn_stock ,   &
+         &             nn_it000, nn_itend  , nn_date0    , nn_leapy     , nn_istate , nn_stock ,   &
          &             nn_write, ln_dimgnnn, ln_mskland  , ln_cfmeta    , ln_clobber, nn_chunksz, nn_euler
       NAMELIST/namdom/ nn_bathy, rn_bathy , rn_e3zps_min, rn_e3zps_rat, nn_msh, rn_hmin,   &
@@ -179,5 +179,4 @@
          WRITE(numout,*) '      number of the last time step    nn_itend   = ', nn_itend
          WRITE(numout,*) '      initial calendar date aammjj    nn_date0   = ', nn_date0
-         WRITE(numout,*) '      initial time of day in hhmm     nn_time0   = ', nn_time0
          WRITE(numout,*) '      leap year calendar (0/1)        nn_leapy   = ', nn_leapy
          WRITE(numout,*) '      initial state output            nn_istate  = ', nn_istate
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 15255)
@@ -37,5 +37,4 @@
    INTEGER       ::   nn_itend         !: index of the last time step
    INTEGER       ::   nn_date0         !: initial calendar date aammjj
-   INTEGER       ::   nn_time0         !: initial time of day in hhmm
    INTEGER       ::   nn_leapy         !: Leap year calendar flag (0/1 or 30)
    INTEGER       ::   nn_istate        !: initial state output flag (0/1)
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/IOM/iom.F90	(revision 15255)
@@ -115,5 +115,5 @@
       CASE (30)   ;   CALL xios_set_context_attr(TRIM(clname), calendar_type= "D360")
       END SELECT
-      WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,',i2.2,':',i2.2,':00')") nyear,nmonth,nday,nhour,nminute
+      WRITE(cldate,"(i4.4,'-',i2.2,'-',i2.2,' 00:00:00')") nyear,nmonth,nday 
       CALL xios_set_context_attr(TRIM(clname), start_date=cldate )
 
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/diaobs.F90	(revision 15255)
@@ -12,5 +12,4 @@
    !!   ini_date     : Compute the initial date YYYYMMDD.HHMMSS
    !!   fin_date     : Compute the final date YYYYMMDD.HHMMSS
-   !!   calc_date    : Get date in YYYYMMDD.HHMMSS format
    !!----------------------------------------------------------------------
    !! * Modules used
@@ -41,9 +40,8 @@
    !! * Routine accessibility
    PRIVATE
-   PUBLIC dia_obs_init,    &  ! Initialize and read observations
-      &   dia_obs,         &  ! Compute model equivalent to observations
-      &   dia_obs_wri,     &  ! Write model equivalent to observations
-      &   dia_obs_dealloc, &  ! Deallocate dia_obs data
-      &   calc_date           ! Compute the date of a timestep
+   PUBLIC dia_obs_init, &  ! Initialize and read observations
+      &   dia_obs,      &  ! Compute model equivalent to observations
+      &   dia_obs_wri,  &  ! Write model equivalent to observations
+      &   dia_obs_dealloc  ! Deallocate dia_obs data
 
    !! * Module variables
@@ -2016,13 +2014,13 @@
    END SUBROUTINE dia_obs_dealloc
 
-   SUBROUTINE calc_date( kstp, ddobs )
+   SUBROUTINE ini_date( ddobsini )
       !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE calc_date  ***
-      !!         
-      !! ** Purpose : Get date in double precision YYYYMMDD.HHMMSS format
+      !!                    ***  ROUTINE ini_date  ***
       !!
-      !! ** Method  : Get date in double precision YYYYMMDD.HHMMSS format
+      !! ** Purpose : Get initial date in double precision YYYYMMDD.HHMMSS format
       !!
-      !! ** Action  : Get date in double precision YYYYMMDD.HHMMSS format
+      !! ** Method  : Get initial date in double precision YYYYMMDD.HHMMSS format
+      !!
+      !! ** Action  : Get initial date in double precision YYYYMMDD.HHMMSS format
       !!
       !! History :
@@ -2032,16 +2030,15 @@
       !!        !  06-10  (G. Smith) Calculates initial date the same as method for final date
       !!        !  10-05  (D. Lea) Update to month length calculation for NEMO vn3.2
-      !!        !  2014-09  (D. Lea) New generic routine now deals with arbitrary initial time of day
       !!----------------------------------------------------------------------
       USE phycst, ONLY : &            ! Physical constants
          & rday
-!      USE daymod, ONLY : &            ! Time variables
-!         & nmonth_len           
       USE dom_oce, ONLY : &           ! Ocean space and time domain variables
          & rdt
+
       IMPLICIT NONE
+
       !! * Arguments
-      REAL(KIND=dp), INTENT(OUT) :: ddobs                        ! Date in YYYYMMDD.HHMMSS
-      INTEGER :: kstp
+      REAL(dp), INTENT(OUT) :: ddobsini  ! Initial date in YYYYMMDD.HHMMSS
+
       !! * Local declarations
       INTEGER :: iyea        ! date - (year, month, day, hour, minute)
@@ -2050,35 +2047,34 @@
       INTEGER :: ihou
       INTEGER :: imin
-      INTEGER :: imday         ! Number of days in month.
-      REAL(KIND=wp) :: zdayfrc ! Fraction of day
-      INTEGER, DIMENSION(12) ::   imonth_len    !: length in days of the months of the current year
-      !!----------------------------------------------------------------------
-      !! Initial date initialization (year, month, day, hour, minute)
-      !!----------------------------------------------------------------------
+      INTEGER :: imday       ! Number of days in month.
+      INTEGER, DIMENSION(12) :: &
+         &       imonth_len  ! Length in days of the months of the current year
+      REAL(wp) :: zdayfrc    ! Fraction of day
+
+      !----------------------------------------------------------------------
+      ! Initial date initialization (year, month, day, hour, minute)
+      ! (This assumes that the initial date is for 00z))
+      !----------------------------------------------------------------------
       iyea =   ndate0 / 10000
       imon = ( ndate0 - iyea * 10000 ) / 100
       iday =   ndate0 - iyea * 10000 - imon * 100
-      ihou =   nn_time0 / 100
-      imin = ( nn_time0 - ihou * 100 ) 
-      !!----------------------------------------------------------------------
-      !! Compute number of days + number of hours + min since initial time
-      !!----------------------------------------------------------------------
-      zdayfrc = kstp * rdt / rday
+      ihou = 0
+      imin = 0
+
+      !----------------------------------------------------------------------
+      ! Compute number of days + number of hours + min since initial time
+      !----------------------------------------------------------------------
+      iday = iday + ( nit000 -1 ) * rdt / rday
+      zdayfrc = ( nit000 -1 ) * rdt / rday
       zdayfrc = zdayfrc - aint(zdayfrc)
-      imin = imin + int( zdayfrc * 24 * 60 ) 
-      DO WHILE (imin >= 60) 
-        imin=imin-60
-        ihou=ihou+1
-      END DO
-      DO WHILE (ihou >= 24)
-        ihou=ihou-24
-        iday=iday+1
-      END DO
-      iday = iday + kstp * rdt / rday 
-      !!-----------------------------------------------------------------------
-      !! Convert number of days (iday) into a real date
-      !!----------------------------------------------------------------------
+      ihou = int( zdayfrc * 24 )
+      imin = int( (zdayfrc * 24 - ihou) * 60 )
+
+      !-----------------------------------------------------------------------
+      ! Convert number of days (iday) into a real date
+      !----------------------------------------------------------------------
+
       CALL calc_month_len( iyea, imonth_len )
-     
+
       DO WHILE ( iday > imonth_len(imon) )
          iday = iday - imonth_len(imon)
@@ -2090,33 +2086,12 @@
          ENDIF
       END DO
-      !!----------------------------------------------------------------------
-      !! Convert it into YYYYMMDD.HHMMSS format.
-      !!----------------------------------------------------------------------
-      ddobs = iyea * 10000_dp + imon * 100_dp + &
-         &    iday + ihou * 0.01_dp + imin * 0.0001_dp
-   END SUBROUTINE calc_date
-
-   SUBROUTINE ini_date( ddobsini )
-      !!----------------------------------------------------------------------
-      !!                    ***  ROUTINE ini_date  ***
-      !!         
-      !! ** Purpose : Get initial data in double precision YYYYMMDD.HHMMSS format
-      !!
-      !! ** Method  : Get initial data in double precision YYYYMMDD.HHMMSS format
-      !!
-      !! ** Action  : Get initial data in double precision YYYYMMDD.HHMMSS format
-      !!
-      !! History :
-      !!        !  06-03  (K. Mogensen)  Original code
-      !!        !  06-05  (K. Mogensen)  Reformatted
-      !!        !  06-10  (A. Weaver) Cleaning
-      !!        !  06-10  (G. Smith) Calculates initial date the same as method for final date
-      !!        !  10-05  (D. Lea) Update to month length calculation for NEMO vn3.2
-      !!    `   !  2014-09  (D. Lea) New generic routine now deals with arbitrary initial time of day
-      !!----------------------------------------------------------------------
-      IMPLICIT NONE
-      !! * Arguments
-      REAL(KIND=dp), INTENT(OUT) :: ddobsini                   ! Initial date in YYYYMMDD.HHMMSS
-      CALL calc_date( nit000 - 1, ddobsini )
+
+      !----------------------------------------------------------------------
+      ! Convert it into YYYYMMDD.HHMMSS format.
+      !----------------------------------------------------------------------
+      ddobsini = iyea * 10000_dp + imon * 100_dp + &
+         &       iday + ihou * 0.01_dp + imin * 0.0001_dp
+
+
    END SUBROUTINE ini_date
 
@@ -2124,10 +2099,10 @@
       !!----------------------------------------------------------------------
       !!                    ***  ROUTINE fin_date  ***
-      !!         
-      !! ** Purpose : Get final data in double precision YYYYMMDD.HHMMSS format
       !!
-      !! ** Method  : Get final data in double precision YYYYMMDD.HHMMSS format
+      !! ** Purpose : Get final date in double precision YYYYMMDD.HHMMSS format
       !!
-      !! ** Action  : Get final data in double precision YYYYMMDD.HHMMSS format
+      !! ** Method  : Get final date in double precision YYYYMMDD.HHMMSS format
+      !!
+      !! ** Action  : Get final date in double precision YYYYMMDD.HHMMSS format
       !!
       !! History :
@@ -2136,11 +2111,68 @@
       !!        !  06-10  (A. Weaver) Cleaning
       !!        !  10-05  (D. Lea) Update to month length calculation for NEMO vn3.2
-      !!    `   !  2014-09  (D. Lea) New generic routine now deals with arbitrary initial time of day
       !!----------------------------------------------------------------------
+      USE phycst, ONLY : &            ! Physical constants
+         & rday
+      USE dom_oce, ONLY : &           ! Ocean space and time domain variables
+         & rdt
+
       IMPLICIT NONE
+
       !! * Arguments
-      REAL(KIND=dp), INTENT(OUT) :: ddobsfin                   ! Final date in YYYYMMDD.HHMMSS
-      CALL calc_date( nitend, ddobsfin )
-   END SUBROUTINE fin_date
+      REAL(dp), INTENT(OUT) :: ddobsfin ! Final date in YYYYMMDD.HHMMSS
+
+      !! * Local declarations
+      INTEGER :: iyea        ! date - (year, month, day, hour, minute)
+      INTEGER :: imon
+      INTEGER :: iday
+      INTEGER :: ihou
+      INTEGER :: imin
+      INTEGER :: imday       ! Number of days in month.
+      INTEGER, DIMENSION(12) :: &
+         &       imonth_len  ! Length in days of the months of the current year
+      REAL(wp) :: zdayfrc    ! Fraction of day
+
+      !-----------------------------------------------------------------------
+      ! Initial date initialization (year, month, day, hour, minute)
+      ! (This assumes that the initial date is for 00z)
+      !-----------------------------------------------------------------------
+      iyea =   ndate0 / 10000
+      imon = ( ndate0 - iyea * 10000 ) / 100
+      iday =   ndate0 - iyea * 10000 - imon * 100
+      ihou = 0
+      imin = 0
+
+      !-----------------------------------------------------------------------
+      ! Compute number of days + number of hours + min since initial time
+      !-----------------------------------------------------------------------
+      iday    = iday +  nitend  * rdt / rday
+      zdayfrc =  nitend  * rdt / rday
+      zdayfrc = zdayfrc - AINT( zdayfrc )
+      ihou    = INT( zdayfrc * 24 )
+      imin    = INT( ( zdayfrc * 24 - ihou ) * 60 )
+
+      !-----------------------------------------------------------------------
+      ! Convert number of days (iday) into a real date
+      !----------------------------------------------------------------------
+
+      CALL calc_month_len( iyea, imonth_len )
+
+      DO WHILE ( iday > imonth_len(imon) )
+         iday = iday - imonth_len(imon)
+         imon = imon + 1 
+         IF ( imon > 12 ) THEN
+            imon = 1
+            iyea = iyea + 1
+            CALL calc_month_len( iyea, imonth_len )  ! update month lengths
+         ENDIF
+      END DO
+
+      !-----------------------------------------------------------------------
+      ! Convert it into YYYYMMDD.HHMMSS format
+      !-----------------------------------------------------------------------
+      ddobsfin = iyea * 10000_dp + imon * 100_dp    + iday &
+         &     + ihou * 0.01_dp  + imin * 0.0001_dp
+
+    END SUBROUTINE fin_date
 
     SUBROUTINE obs_settypefiles( ntypes, jpmaxnfiles, ifiles, cobstypes, cfiles )
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/obs_prep.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/obs_prep.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/OBS/obs_prep.F90	(revision 15255)
@@ -133,6 +133,6 @@
       imon0 = ( ndate0 - iyea0 * 10000 ) / 100
       iday0 =   ndate0 - iyea0 * 10000 - imon0 * 100
-      ihou0 =   nn_time0 / 100
-      imin0 = ( nn_time0 - ihou0 * 100 )
+      ihou0 = 0
+      imin0 = 0
 
       icycle = no     ! Assimilation cycle
@@ -378,6 +378,6 @@
       imon0 = ( ndate0 - iyea0 * 10000 ) / 100
       iday0 =   ndate0 - iyea0 * 10000 - imon0 * 100
-      ihou0 =   nn_time0 / 100
-      imin0 = ( nn_time0 - ihou0 * 100 )
+      ihou0 = 0
+      imin0 = 0
 
       icycle = no     ! Assimilation cycle
Index: branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/SBC/sbctide.F90
===================================================================
--- branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/SBC/sbctide.F90	(revision 15254)
+++ branches/UKMO/dev_r5518_obs_oper_update/NEMOGCM/NEMO/OPA_SRC/SBC/sbctide.F90	(revision 15255)
@@ -47,8 +47,7 @@
       INTEGER, INTENT( in ) ::   kt     ! ocean time-step
       INTEGER               ::   jk     ! dummy loop index
-      INTEGER               ::   nsec_day_orig     ! Temporary variable
       !!----------------------------------------------------------------------
 
-      IF( nsec_day == NINT(0.5_wp * rdttra(1)) .OR. kt == nit000 ) THEN    ! start a new day
+      IF( nsec_day == NINT(0.5_wp * rdttra(1)) ) THEN      ! start a new day
          !
          IF( kt == nit000 ) THEN
@@ -61,16 +60,7 @@
          pot_astro(:,:) = 0._wp
          !
-         ! If the run does not start from midnight then need to initialise tides
-         ! at the start of the current day (only occurs when kt==nit000)
-         ! Temporarily set nsec_day to beginning of day.
-         nsec_day_orig = nsec_day
-         IF ( nsec_day /= NINT(0.5_wp * rdttra(1)) ) THEN
-            kt_tide = kt - (nsec_day - 0.5_wp * rdttra(1))/rdttra(1)
-            nsec_day = NINT(0.5_wp * rdttra(1))
-         ELSE
-            kt_tide = kt 
-         ENDIF
+         CALL tide_harmo( omega_tide, v0tide, utide, ftide, ntide, nb_harmo )
          !
-         CALL tide_harmo( omega_tide, v0tide, utide, ftide, ntide, nb_harmo )
+         kt_tide = kt
          !
          IF(lwp) THEN
@@ -84,7 +74,4 @@
          !
          IF( ln_tide_pot )   CALL tide_init_potential
-         !
-         ! Reset nsec_day
-         nsec_day = nsec_day_orig
          !
       ENDIF
