Index: IOIPSL/trunk/src/calendar.f90
===================================================================
--- IOIPSL/trunk/src/calendar.f90	(revision 11)
+++ IOIPSL/trunk/src/calendar.f90	(revision 236)
@@ -5,14 +5,27 @@
 !- This is the calendar which going to be used to do all
 !- calculations on time. Three types of calendars are possible :
-!-  - gregorian : The normal calendar. The time origin for the
-!-                julian day in this case is 24 Nov -4713
-!-  - nolap : A 365 day year without leap years.
-!-            The origin for the julian days is in this case 1 Jan 0
-!-  - xxxd : Year of xxx days with month of equal length.
-!-           The origin for the julian days is then also 1 Jan 0
+!-
+!-  - gregorian :
+!-      The normal calendar. The time origin for the
+!-      julian day in this case is 24 Nov -4713
+!-      (other names : 'standard','proleptic_gregorian')
+!-  - noleap :
+!-      A 365 day year without leap years.
+!-      The origin for the julian days is in this case 1 Jan 0
+!-      (other names : '365_day','365d')
+!-  - all_leap :
+!-      A 366 day year with leap years.
+!-      The origin for the julian days is in this case ????
+!-      (other names : '366_day','366d'
+!-  - julian :
+!-      same as gregorian, but with all leap century years
+!-  - xxxd :
+!-      Year of xxx days with month of equal length.
+!-      The origin for the julian days is then also 1 Jan 0
+!-
 !- As one can see it is difficult to go from one calendar to the other.
 !- All operations involving julian days will be wrong.
 !- This calendar will lock as soon as possible
-!- the length of the year and  forbid any further modification.
+!- the length of the year and forbid any further modification.
 !-
 !- For the non leap-year calendar the method is still brute force.
@@ -235,4 +248,5 @@
   INTEGER :: l,n,i,jd,j,d,m,y,ml
   INTEGER :: add_day
+  REAL :: eps_day = SPACING(one_day)
 !---------------------------------------------------------------------
   lock_one_year = .TRUE.
@@ -240,10 +254,10 @@
   jd = julian_day
   sec = julian_sec
-  IF (sec > one_day) THEN
+  IF (sec > (one_day-eps_day)) THEN
     add_day = INT(sec/one_day)
     sec = sec-add_day*one_day
     jd = jd+add_day
   ENDIF
-  IF (sec < 0.) THEN
+  IF (sec < -eps_day) THEN
     sec = sec+one_day
     jd = jd-1
@@ -295,5 +309,5 @@
 SUBROUTINE tlen2itau (input_str,dt,date,itau)
 !---------------------------------------------------------------------
-!- This subroutine transforms a sting containing a time length
+!- This subroutine transforms a string containing a time length
 !- into a number of time steps.
 !- To do this operation the date (in julian days is needed as the
@@ -388,5 +402,5 @@
 REAL FUNCTION itau2date (itau,date0,deltat)
 !---------------------------------------------------------------------
-!- This function transforms itau into a date. The date whith which
+!- This function transforms itau into a date. The date with which
 !- the time axis is going to be labeled
 !-
@@ -410,7 +424,7 @@
 !===
 !-
-SUBROUTINE itau2ymds (itau,deltat,year,month,date,sec)
-!---------------------------------------------------------------------
-!- This subroutine transforms itau into a date. The date whith which
+SUBROUTINE itau2ymds (itau,deltat,year,month,day,sec)
+!---------------------------------------------------------------------
+!- This subroutine transforms itau into a date. The date with which
 !- the time axis is going to be labeled
 !-
@@ -420,8 +434,8 @@
 !-
 !- OUTPUT
-!-   year : year
+!-   year  : year
 !-   month : month
-!-   date : date
-!-   sec  : seconds since midnight
+!-   day   : day
+!-   sec   : seconds since midnight
 !---------------------------------------------------------------------
   IMPLICIT NONE
@@ -430,5 +444,5 @@
   REAL,INTENT(IN)    :: deltat
 !-
-  INTEGER,INTENT(OUT) :: year,month,date
+  INTEGER,INTENT(OUT) :: year,month,day
   REAL,INTENT(OUT)    :: sec
 !-
@@ -436,8 +450,13 @@
   REAL    :: julian_sec
 !---------------------------------------------------------------------
+  IF (.NOT.lock_startdate) THEN
+    CALL ipslerr (2,'itau2ymds', &
+ &   'You try to call this function, itau2ymds, but you didn''t', &
+ &   ' call ioconf_startdate to initialize date0 in calendar.', &
+ &   ' Please call ioconf_startdate before itau2ymds.')
+  ENDIF
   julian_day = start_day
   julian_sec = start_sec+REAL(itau)*deltat
-!-
-  CALL ju2ymds_internal (julian_day,julian_sec,year,month,date,sec)
+  CALL ju2ymds_internal (julian_day,julian_sec,year,month,day,sec)
 !-----------------------
 END SUBROUTINE itau2ymds
