Index: /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/extract_rst.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/extract_rst.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/extract_rst.sh	(revision 7114)
@@ -109,5 +109,5 @@
 # ==========
 #
-# $Id$
+# $Id: extract_rst.sh 2246 2010-10-13 09:47:23Z rblod $
 #
 # - fplod 2009-04-20T08:13:37Z aedon.locean-ipsl.upmc.fr (Darwin)
Index: /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/install.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/install.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/install.sh	(revision 7114)
@@ -47,5 +47,5 @@
 # ==========
 #
-# $Id$
+# $Id: install.sh 2246 2010-10-13 09:47:23Z rblod $
 #
 # - fplod 2008-09-16T15:24:26Z aedon.locean-ipsl.upmc.fr (Darwin)
Index: /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/makefile_compile
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/makefile_compile	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/ADM/DOC_SCRIPTS/makefile_compile	(revision 7114)
@@ -21,5 +21,5 @@
 # ==========
 #
-# $Id$
+# $Id: makefile_compile 2520 2010-12-27 14:43:36Z rblod $
 #
 # - fplod 20100419T145702Z aedon.locean-ipsl.upmc.fr (Darwin)
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/CONFIG/makenemo
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/CONFIG/makenemo	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/CONFIG/makenemo	(revision 7114)
@@ -75,5 +75,5 @@
 # ==========
 #
-# $Id$
+# $Id: makenemo 5144 2015-03-11 15:51:28Z timgraham $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/rebuild
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/rebuild	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/rebuild	(revision 7114)
@@ -1,5 +1,5 @@
 #!/bin/ksh
 #
-#$Id$
+#$Id: rebuild 2281 2010-10-15 14:21:13Z smasson $
 #
 # This software is governed by the CeCILL license
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkcond.c
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkcond.c	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkcond.c	(revision 7114)
@@ -1,4 +1,4 @@
 /* parser config.in
- * $Id$
+ * $Id: tkcond.c 2281 2010-10-15 14:21:13Z smasson $
  *
  * This software is governed by the CeCILL license
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkgen.c
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkgen.c	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkgen.c	(revision 7114)
@@ -1,4 +1,4 @@
 /* Generate tk script based upon config.in
- * $Id$
+ * $Id: tkgen.c 2281 2010-10-15 14:21:13Z smasson $
  *
  * This software is governed by the CeCILL license
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkparse.c
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkparse.c	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/EXTERNAL/IOIPSL/tools/tkparse.c	(revision 7114)
@@ -1,4 +1,4 @@
 /* parser config.in
- * $Id$
+ * $Id: tkparse.c 2281 2010-10-15 14:21:13Z smasson $
  *
  * This software is governed by the CeCILL license
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/DOM/domain.F90	(revision 7114)
@@ -136,5 +136,5 @@
       USE ioipsl
       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_no   , cn_exp    , cn_ocerst_in, cn_ocerst_out, ln_rstart , ln_rstdate, nn_rstctl,   &
          &             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
@@ -173,4 +173,5 @@
          WRITE(numout,*) '      restart output directory        cn_ocerst_outdir= ', cn_ocerst_outdir
          WRITE(numout,*) '      restart logical                 ln_rstart  = ', ln_rstart
+         WRITE(numout,*) '      datestamping of restarts        ln_rstdate  = ', ln_rstdate
          WRITE(numout,*) '      start with forward time step    nn_euler   = ', nn_euler
          WRITE(numout,*) '      control of time step            nn_rstctl  = ', nn_rstctl
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/ICB/icbrst.F90	(revision 7114)
@@ -18,4 +18,6 @@
    !!----------------------------------------------------------------------
    USE par_oce        ! NEMO parameters
+   USE phycst         ! for rday
+   USE ioipsl, ONLY : ju2ymds    ! for calendar
    USE dom_oce        ! NEMO domain
    USE in_out_manager ! NEMO IO routines
@@ -231,6 +233,10 @@
       INTEGER ::   jn   ! dummy loop index
       INTEGER ::   ix_dim, iy_dim, ik_dim, in_dim
-      CHARACTER(len=256)     :: cl_path
-      CHARACTER(len=256)     :: cl_filename
+      INTEGER             ::   iyear, imonth, iday 
+      REAL (wp)           ::   zsec 
+      REAL (wp)           ::   zfjulday
+      CHARACTER(len=256)  :: cl_path 
+      CHARACTER(len=256)  :: cl_filename 
+      CHARACTER(LEN=20)   ::   clkt     ! ocean time-step defined as a character 
       TYPE(iceberg), POINTER :: this
       TYPE(point)  , POINTER :: pt
@@ -240,8 +246,18 @@
       cl_path = TRIM(cn_ocerst_outdir)
       IF( cl_path(LEN_TRIM(cl_path):) /= '/' ) cl_path = TRIM(cl_path) // '/'
+      IF ( ln_rstdate ) THEN 
+         zfjulday = fjulday + rdttra(1) / rday 
+         IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
+         CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
+         WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
+      ELSE 
+         IF( kt > 999999999 ) THEN   ;   WRITE(clkt, *       ) kt 
+         ELSE                        ;   WRITE(clkt, '(i8.8)') kt 
+         ENDIF 
+      ENDIF 
       IF( lk_mpp ) THEN
-         WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart_",I4.4,".nc")') TRIM(cexper), kt, narea-1
+         WRITE(cl_filename,'(A,"_icebergs_",A,"_restart_",I4.4,".nc")') TRIM(cexper), TRIM(ADJUSTL(clkt)), narea-1
       ELSE
-         WRITE(cl_filename,'(A,"_icebergs_",I8.8,"_restart.nc")') TRIM(cexper), kt
+         WRITE(cl_filename,'(A,"_icebergs_",A,"_restart.nc")') TRIM(cexper), TRIM(ADJUSTL(clkt))
       ENDIF
       IF (nn_verbose_level >= 0) WRITE(numout,'(2a)') 'icebergs, write_restart: creating ',TRIM(cl_path)//TRIM(cl_filename)
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 7114)
@@ -30,4 +30,5 @@
    CHARACTER(lc) ::   cn_ocerst_outdir !: restart output directory
    LOGICAL       ::   ln_rstart        !: start from (F) rest or (T) a restart file
+   LOGICAL       ::   ln_rstdate       !: datestamping of restarts
    LOGICAL       ::   ln_rst_list      !: output restarts at list of times (T) or by frequency (F)
    INTEGER       ::   nn_no            !: job number
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/IOM/restart.F90	(revision 7114)
@@ -27,4 +27,5 @@
    USE in_out_manager  ! I/O manager
    USE iom             ! I/O module
+   USE ioipsl, ONLY : ju2ymds    ! for calendar
 
    IMPLICIT NONE
@@ -57,8 +58,11 @@
       !!----------------------------------------------------------------------
       INTEGER, INTENT(in) ::   kt     ! ocean time-step
+      INTEGER             ::   iyear, imonth, iday 
+      REAL (wp)           ::   zsec 
+      REAL (wp)           ::   zfjulday
       !!
       CHARACTER(LEN=20)   ::   clkt     ! ocean time-step deine as a character
       CHARACTER(LEN=50)   ::   clname   ! ocean output restart file name
-      CHARACTER(lc)       ::   clpath   ! full path to ocean output restart file
+      CHARACTER(LEN=150)  ::   clpath   ! full path to ocean output restart file
       !!----------------------------------------------------------------------
       !
@@ -84,7 +88,14 @@
       IF( kt == nitrst - 1 .OR. nstock == 1 .OR. ( kt == nitend .AND. .NOT. lrst_oce ) ) THEN
          IF( nitrst <= nitend .AND. nitrst > 0 ) THEN 
-            ! beware of the format used to write kt (default is i8.8, that should be large enough...)
-            IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst
-            ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst
+            IF ( ln_rstdate ) THEN 
+               zfjulday = fjulday + rdttra(1) / rday 
+               IF( ABS(zfjulday - REAL(NINT(zfjulday),wp)) < 0.1 / rday )   zfjulday = REAL(NINT(zfjulday),wp)   ! avoid truncation error 
+               CALL ju2ymds( zfjulday, iyear, imonth, iday, zsec )            
+               WRITE(clkt, '(i4.4,2i2.2)') iyear, imonth, iday 
+            ELSE 
+            ! beware of the format used to write kt (default is i8.8, that should be large enough...) 
+               IF( nitrst > 999999999 ) THEN   ;   WRITE(clkt, *       ) nitrst 
+               ELSE                            ;   WRITE(clkt, '(i8.8)') nitrst 
+               ENDIF 
             ENDIF
             ! create the file
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/module_example
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/module_example	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/NEMO/OPA_SRC/module_example	(revision 7114)
@@ -52,5 +52,5 @@
    !!----------------------------------------------------------------------
    !! NEMO/OPA 3.3 , NEMO Consortium (2010)
-   !! $Id$ 
+   !! $Id: module_example 4147 2013-11-04 11:51:55Z cetlod $ 
    !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
    !!----------------------------------------------------------------------
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/SETTE/all_functions.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/SETTE/all_functions.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/SETTE/all_functions.sh	(revision 7114)
@@ -79,5 +79,5 @@
 # ==========
 #
-# $Id$
+# $Id: all_functions.sh 4316 2013-11-26 15:43:56Z clevy $
 #
 #   * creation
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_archfile.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_archfile.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_archfile.sh	(revision 7114)
@@ -52,5 +52,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fcheck_archfile.sh 4162 2013-11-07 10:19:49Z cetlod $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_config.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_config.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_config.sh	(revision 7114)
@@ -58,5 +58,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fcheck_config.sh 4990 2014-12-15 16:42:49Z timgraham $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_script.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_script.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcheck_script.sh	(revision 7114)
@@ -45,5 +45,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fcheck_script.sh 3294 2012-01-28 16:44:18Z rblod $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fclean_var.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fclean_var.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fclean_var.sh	(revision 7114)
@@ -45,5 +45,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fclean_var.sh 4990 2014-12-15 16:42:49Z timgraham $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcopy_dir.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcopy_dir.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fcopy_dir.sh	(revision 7114)
@@ -46,5 +46,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fcopy_dir.sh 4990 2014-12-15 16:42:49Z timgraham $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fgo_to_TOOLS.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fgo_to_TOOLS.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fgo_to_TOOLS.sh	(revision 7114)
@@ -45,5 +45,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fgo_to_TOOLS.sh 3294 2012-01-28 16:44:18Z rblod $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Flist_archfile.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Flist_archfile.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Flist_archfile.sh	(revision 7114)
@@ -48,5 +48,5 @@
 # ==========
 #
-# $Id$
+# $Id: Flist_archfile.sh 4148 2013-11-04 12:54:28Z cetlod $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_WORK.sh	(revision 7114)
@@ -57,5 +57,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fmake_WORK.sh 4990 2014-12-15 16:42:49Z timgraham $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_bld.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_bld.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_bld.sh	(revision 7114)
@@ -51,5 +51,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fmake_bld.sh 3294 2012-01-28 16:44:18Z rblod $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_config.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_config.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fmake_config.sh	(revision 7114)
@@ -50,5 +50,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fmake_config.sh 3715 2012-11-28 16:06:02Z acc $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fprep_agrif.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fprep_agrif.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fprep_agrif.sh	(revision 7114)
@@ -47,5 +47,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fprep_agrif.sh 5656 2015-07-31 08:55:56Z timgraham $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fread_dir.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fread_dir.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/COMPILE/Fread_dir.sh	(revision 7114)
@@ -45,5 +45,5 @@
 # ==========
 #
-# $Id$
+# $Id: Fread_dir.sh 3294 2012-01-28 16:44:18Z rblod $
 #
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/MISCELLANEOUS/chk_iomput.sh	(revision 7114)
@@ -1,5 +1,5 @@
 #!/bin/bash
 #------------------------------------------------
-#$Id$
+#$Id: chk_iomput.sh 4162 2013-11-07 10:19:49Z cetlod $
 #------------------------------------------------
 #
Index: /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/maketools
===================================================================
--- /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/maketools	(revision 7113)
+++ /branches/UKMO/r5936_restart_datestamp/NEMOGCM/TOOLS/maketools	(revision 7114)
@@ -64,5 +64,5 @@
 # ==========
 #
-# $Id$
+# $Id: maketools 4363 2014-01-22 11:11:47Z rfurner $
 #
 #
