Index: NEMO/branches/2020/test_12905_xios_restart/src/OCE/timing.F90
===================================================================
--- NEMO/branches/2020/test_12905_xios_restart/src/OCE/timing.F90	(revision 12987)
+++ NEMO/branches/2020/test_12905_xios_restart/src/OCE/timing.F90	(revision 13751)
@@ -213,5 +213,5 @@
  
  
-   SUBROUTINE timing_init
+   SUBROUTINE timing_init( clname )
       !!----------------------------------------------------------------------
       !!               ***  ROUTINE timing_init  ***
@@ -221,10 +221,16 @@
       REAL(wp) :: zdum
       LOGICAL :: ll_f
-             
+      CHARACTER(len=*), INTENT(in), OPTIONAL :: clname
+      CHARACTER(len=20)                      :: cln
+
+      IF( PRESENT(clname) ) THEN   ;   cln = clname
+      ELSE                         ;   cln = 'timing.output'
+      ENDIF
+
       IF( ln_onefile ) THEN
-         IF( lwp) CALL ctl_opn( numtime, 'timing.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,.TRUE., narea )
+         IF( lwp) CALL ctl_opn( numtime, cln, 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,.TRUE., narea )
          lwriter = lwp
       ELSE
-         CALL ctl_opn( numtime, 'timing.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,.FALSE., narea )
+         CALL ctl_opn( numtime, cln, 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, numout,.FALSE., narea )
          lwriter = .TRUE.
       ENDIF
@@ -418,5 +424,5 @@
          s_timer => s_timer_root
          DO WHILE ( ASSOCIATED( s_timer%next ) )
-         IF (.NOT. ASSOCIATED(s_timer%next)) EXIT
+            IF (.NOT. ASSOCIATED(s_timer%next)) EXIT
             IF ( s_timer%tsum_clock < s_timer%next%tsum_clock ) THEN 
                ALLOCATE(s_wrk)
@@ -426,7 +432,7 @@
                ll_ord = .FALSE.
                CYCLE            
-            ENDIF           
-         IF( ASSOCIATED(s_timer%next) ) s_timer => s_timer%next
-         END DO         
+            ENDIF
+            IF( ASSOCIATED(s_timer%next) ) s_timer => s_timer%next
+         END DO
          IF( ll_ord ) EXIT
       END DO
@@ -441,8 +447,9 @@
       clfmt = '(1x,a,4x,f12.3,6x,f12.3,x,f12.3,2x,f12.3,6x,f7.3,2x,i9)'
       DO WHILE ( ASSOCIATED(s_timer) )
-         WRITE(numtime,TRIM(clfmt))   s_timer%cname,   &
-         &   s_timer%tsum_clock,s_timer%tsum_clock*100./t_elaps(2),            &
-         &   s_timer%tsum_cpu  ,s_timer%tsum_cpu*100./t_cpu(2)    ,            &
-         &   s_timer%tsum_cpu/s_timer%tsum_clock, s_timer%niter
+         IF( s_timer%tsum_clock > 0._wp )                                &
+            WRITE(numtime,TRIM(clfmt))   s_timer%cname,                  &
+            &   s_timer%tsum_clock,s_timer%tsum_clock*100./t_elaps(2),   &
+            &   s_timer%tsum_cpu  ,s_timer%tsum_cpu*100./t_cpu(2)    ,   &
+            &   s_timer%tsum_cpu/s_timer%tsum_clock, s_timer%niter
          s_timer => s_timer%next
       END DO
@@ -607,11 +614,12 @@
          clfmt = '((A),E15.7,2x,f6.2,5x,f12.2,5x,f6.2,5x,f7.2,2x,f12.2,4x,f6.2,2x,f9.2)'
          DO WHILE ( ASSOCIATED(sl_timer_ave) )
-            WRITE(numtime,TRIM(clfmt))   sl_timer_ave%cname(1:18),                            &
-            &   sl_timer_ave%tsum_clock,sl_timer_ave%tsum_clock*100.*jpnij/tot_etime,   &
-            &   sl_timer_ave%tsum_cpu  ,sl_timer_ave%tsum_cpu*100.*jpnij/tot_ctime  ,   &
-            &   sl_timer_ave%tsum_cpu/sl_timer_ave%tsum_clock,                          &
-            &   sl_timer_ave%tmax_clock*100.*jpnij/tot_etime,                           &
-            &   sl_timer_ave%tmin_clock*100.*jpnij/tot_etime,                           &                                               
-            &   sl_timer_ave%niter/REAL(jpnij)
+            IF( sl_timer_ave%tsum_clock > 0. )                                             & 
+               WRITE(numtime,TRIM(clfmt))   sl_timer_ave%cname(1:18),                      &
+               &   sl_timer_ave%tsum_clock,sl_timer_ave%tsum_clock*100.*jpnij/tot_etime,   &
+               &   sl_timer_ave%tsum_cpu  ,sl_timer_ave%tsum_cpu*100.*jpnij/tot_ctime  ,   &
+               &   sl_timer_ave%tsum_cpu/sl_timer_ave%tsum_clock,                          &
+               &   sl_timer_ave%tmax_clock*100.*jpnij/tot_etime,                           &
+               &   sl_timer_ave%tmin_clock*100.*jpnij/tot_etime,                           &
+               &   sl_timer_ave%niter/REAL(jpnij)
             sl_timer_ave => sl_timer_ave%next
          END DO
