Index: XIOS/trunk/src/calendar.cpp
===================================================================
--- XIOS/trunk/src/calendar.cpp	(revision 546)
+++ XIOS/trunk/src/calendar.cpp	(revision 549)
@@ -12,5 +12,5 @@
          , timeOrigin(*this)
          , currentDate(*this)
-      {   }
+      {}
 
       CCalendar::CCalendar(const StdString& id)
@@ -19,15 +19,15 @@
                , timeOrigin(*this)
                , currentDate(*this)
-      { }
-      
+      {}
+
       CCalendar::CCalendar(const StdString& id,
-                           int yr, int mth, int d  ,
-                           int hr, int min, int sec)
+                           int yr, int mth, int d,
+                           int hr /*= 0*/, int min /*= 0*/, int sec /*= 0*/)
                : CObject(id)
                , initDate(*this)
                , timeOrigin(*this)
                , currentDate(*this)
-      { 
-        initializeDate(yr, mth, d, hr, min, sec) ;
+      {
+        initializeDate(yr, mth, d, hr, min, sec);
       }
 
@@ -66,25 +66,24 @@
 
       void CCalendar::initializeDate(int yr, int mth, int d,
-                                     int hr, int min, int sec)
+                                     int hr /*= 0*/, int min /*= 0*/, int sec /*= 0*/)
       {
-        initDate=CDate(*this,yr, mth, d, hr, min, sec) ;
-        timeOrigin=initDate;
-        currentDate=initDate ;
+        initDate = CDate(*this, yr, mth, d, hr, min, sec);
+        timeOrigin = initDate;
+        currentDate = initDate;
       }
 
       void CCalendar::initializeDate(const StdString& dateStr)
-      { 
-        initDate=CDate::FromString(dateStr, *this) ;
-        timeOrigin=initDate ;
-        currentDate=initDate ;
+      {
+        initDate = CDate::FromString(dateStr, *this);
+        timeOrigin = initDate;
+        currentDate = initDate;
       }
 
       void CCalendar::initializeDate(const StdString& dateStr, const StdString& timeOriginStr)
-      { 
-        initDate=CDate::FromString(dateStr, *this) ;
-        timeOrigin=CDate::FromString(timeOriginStr, *this) ;
-        currentDate=initDate ;
+      {
+        initDate = CDate::FromString(dateStr, *this);
+        timeOrigin = CDate::FromString(timeOriginStr, *this);
+        currentDate = initDate;
       }
-      
 
       CCalendar::~CCalendar(void)
@@ -102,5 +101,5 @@
       }
 
-      void CCalendar::fromString(const StdString & str)
+      void CCalendar::fromString(const StdString& str)
       { ERROR("CCalendar::fromString(str)",
                << "[ str = " << str << "] Not implemented yet !"); }
@@ -108,58 +107,72 @@
       //-----------------------------------------------------------------
 
-      void CCalendar::setTimeStep(const CDuration & duration)
-      { this->timestep = duration; }
+      void CCalendar::setTimeStep(const CDuration& timestep)
+      {
+        if (timestep.timestep)
+          ERROR("CCalendar::setTimeStep(const CDuration& timestep)",
+                << "Circular definition of the timestep: the timestep cannot refer to itself.");
+        this->timestep = timestep;
+      }
 
-      CDate & CCalendar::update(int step)
-      { 
-         info(20) << "update step : " << step <<" timestep "<<this->timestep << std::endl;
-         return (this->getCurrentDate() = this->getInitDate() + step * this->timestep);
+      CDate& CCalendar::update(int step)
+      {
+        info(20) << "update step : " << step << " timestep " << this->timestep << std::endl;
+        return (this->getCurrentDate() = this->getInitDate() + step * this->timestep);
       }
 
       //-----------------------------------------------------------------
 
-      const CDuration & CCalendar::getTimeStep(void) const { return (this->timestep); }
-      const CDate & CCalendar::getInitDate(void) const     { return (this->initDate); }
-      const CDate & CCalendar::getTimeOrigin(void) const     { return (this->timeOrigin); }
-      CDate & CCalendar::getCurrentDate(void)              { return (this->currentDate); }
+      void CCalendar::setInitDate(const CDate& initDate)
+      {
+        if (&initDate.getRelCalendar() != this)
+          ERROR("CCalendar::setInitDate(const CDate& initDate)",
+                << "The init date cannot be attached to another calendar.");
+        this->initDate = initDate;
+      }
+
+      void CCalendar::setTimeOrigin(const CDate& timeOrigin)
+      {
+        if (&timeOrigin.getRelCalendar() != this)
+          ERROR("CCalendar::setInitDate(const CDate& timeOrigin)",
+                << "The time origin cannot be attached to another calendar.");
+        this->timeOrigin = timeOrigin;
+      }
 
       //-----------------------------------------------------------------
 
-      int CCalendar::getMonthLength(const CDate & date) const
+      const CDuration& CCalendar::getTimeStep(void) const { return this->timestep; }
+      const CDate& CCalendar::getInitDate(void) const     { return this->initDate; }
+      const CDate& CCalendar::getTimeOrigin(void) const   { return this->timeOrigin; }
+      CDate& CCalendar::getCurrentDate(void)              { return this->currentDate; }
+
+      //-----------------------------------------------------------------
+
+      int CCalendar::getMonthLength(const CDate& date) const
       { // Retourne la durÃ©e du mois en jour.
-         static const int NoLeapMonthLength[] =
-            {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-         return (NoLeapMonthLength[date.getMonth()-1]);
+        static const int NoLeapMonthLength[] =
+          { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+        return NoLeapMonthLength[date.getMonth() - 1];
       }
 
-      StdString CCalendar::getType(void) const { return (StdString(this->getId())); }
+      StdString CCalendar::getType(void) const { return StdString(this->getId()); }
 
-      int CCalendar::getYearTotalLength(const CDate & date) const { return (365 * 86400); }
+      int CCalendar::getYearTotalLength(const CDate& date) const { return (365 * 86400); }
 
-      int CCalendar::getYearLength  (void) const { return (12); }
-      int CCalendar::getDayLength   (void) const { return (24); }
-      int CCalendar::getHourLength  (void) const { return (60); }
-      int CCalendar::getMinuteLength(void) const { return (60); }
+      int CCalendar::getYearLength  (void) const { return 12; }
+      int CCalendar::getDayLength   (void) const { return 24; }
+      int CCalendar::getHourLength  (void) const { return 60; }
+      int CCalendar::getMinuteLength(void) const { return 60; }
+      int CCalendar::getDayLengthInSeconds(void) const { return getDayLength() * getHourLength() * getMinuteLength(); }
 
-      int CCalendar::getNbSecond(const CDate & date) const
-      { // Retourne le nombre de secondes Ã©coulÃ©es depuis le dÃ©but de l'annÃ©e.
-         CDate _d0(date); int  nbday = 0;
-
-         for(_d0.setMonth(1); _d0.getMonth() < date.getMonth(); _d0.setMonth(_d0.getMonth()+1))
-            nbday += getMonthLength(_d0);
-         return ((((nbday + date.getDay()) * getDayLength() + date.getHour()) * getHourLength()
-                     + date.getMinute()) * getMinuteLength() + date.getSecond());
+      StdString CCalendar::getMonthName(int monthId) const
+      {
+        static const StdString MonthNames[] =
+          { "january", "february", "march",     "april" ,  "may",      "june",
+            "july",    "august",   "september", "october", "november", "december" };
+        return MonthNames[monthId - 1];
       }
 
-      StdString CCalendar::getMonthName(int month_id) const
-      {
-         static const StdString Monthname_str[] =
-            { "january", "february", "march"    , "april"  , "may"     , "june"    ,
-              "july"   , "august"  , "september", "october", "november", "december" };
-         return(Monthname_str[month_id-1]);
-      }
-
-      const StdString CCalendar::getMonthShortName(int month_id) const
-      { StdString value = this->getMonthName(month_id); value.resize(3); return (value); }
+      const StdString CCalendar::getMonthShortName(int monthId) const
+      { StdString value = this->getMonthName(monthId); value.resize(3); return value; }
 
       ///----------------------------------------------------------------
Index: XIOS/trunk/src/calendar.hpp
===================================================================
--- XIOS/trunk/src/calendar.hpp	(revision 546)
+++ XIOS/trunk/src/calendar.hpp	(revision 549)
@@ -33,5 +33,5 @@
             /// Constructeurs ///
             CCalendar(void);
-            CCalendar(const StdString& id) ;
+            CCalendar(const StdString& id);
             CCalendar(const StdString& id,
                       int yr, int mth, int d,
@@ -49,26 +49,28 @@
             /// Autres ///
             virtual StdString toString(void) const;
-            virtual void fromString(const StdString & str);
+            virtual void fromString(const StdString& str);
 
             /// Mutateur ///
-            void setTimeStep(const CDuration & duration);
+            void setTimeStep(const CDuration& timestep);
+            void setInitDate(const CDate& initDate);
+            void setTimeOrigin(const CDate& timeOrigin);
 
             /// Traitemants ///
-            CDate & update(int step);
+            CDate& update(int step);
 
             /// Accesseurs ///
-            const CDuration & getTimeStep(void) const;
-            const CDate & getInitDate(void) const;
-            const CDate & getTimeOrigin(void) const;
-             CDate & getCurrentDate(void);
-            
+            const CDuration& getTimeStep(void) const;
+            const CDate& getInitDate(void) const;
+            const CDate& getTimeOrigin(void) const;
+            CDate& getCurrentDate(void);
+
          public :
-         
+
             //------------------------------------------------------------
-            virtual int getMonthLength(const CDate & date) const ;
+            virtual int getMonthLength(const CDate& date) const;
 
             virtual StdString getType(void) const;
 
-            virtual int getYearTotalLength(const CDate & date) const ; // Retourne la durÃ©e d'une annÃ©e en seconde.
+            virtual int getYearTotalLength(const CDate& date) const; // Retourne la durÃ©e d'une annÃ©e en seconde.
 
             virtual int getYearLength  (void) const; // Retourne la durÃ©e d'une annÃ©e en mois.
@@ -76,17 +78,18 @@
             virtual int getHourLength  (void) const; // Retourne la durÃ©e d'une heure en minute.
             virtual int getMinuteLength(void) const; // Retourne la durÃ©e d'une minute en secondes.
+            //!< Returns the day length expressed in seconds
+            virtual int getDayLengthInSeconds(void) const;
 
-            virtual int getNbSecond(const CDate & date) const;
             virtual StdString getMonthName(int month_id) const;
 
             virtual const StdString getMonthShortName(int month_id) const;
-            void initializeDate(int yr, int mth, int d, int hr = 0, int min = 0, int sec = 0) ;
-            void initializeDate(const StdString & dateStr);
-            void initializeDate(const StdString & dateStr, const StdString & timeOrigin);
+            void initializeDate(int yr, int mth, int d, int hr = 0, int min = 0, int sec = 0);
+            void initializeDate(const StdString& dateStr);
+            void initializeDate(const StdString& dateStr, const StdString& timeOrigin);
 
             //------------------------------------------------------------
 
          protected:
-            
+
             //!< Associate the dates to the calendar and check their validity
             void initializeDate();
Index: XIOS/trunk/src/calendar_util.cpp
===================================================================
--- XIOS/trunk/src/calendar_util.cpp	(revision 546)
+++ XIOS/trunk/src/calendar_util.cpp	(revision 549)
@@ -5,24 +5,24 @@
       /// ////////////////////// DÃ©finitions ////////////////////// ///
 
-      CDuration operator*(const double & scal, const CDuration & ddr)
+      CDuration operator*(const double& scal, const CDuration& ddr)
       { return (ddr * scal); }
 
-      CDuration operator-(const CDuration & ddr , const CDuration & dr)
-      {
-         CDuration dur(ddr);
-         dur.year -= dr.year;  dur.month  -= dr.month ; dur.day    -= dr.day;
+      CDuration operator-(const CDuration& ddr , const CDuration& dr)
+      {
+         CDuration dur(ddr);
+         dur.year -= dr.year;  dur.month  -= dr.month; dur.day    -= dr.day;
          dur.hour -= dr.hour;  dur.minute -= dr.minute; dur.second -= dr.second; dur.timestep -= dr.timestep;
          return (dur);
       }
 
-      CDuration operator+(const CDuration & ddr , const CDuration & dr)
-      {
-         CDuration dur(ddr);
-         dur.year += dr.year;  dur.month  += dr.month ; dur.day    += dr.day;
+      CDuration operator+(const CDuration& ddr , const CDuration& dr)
+      {
+         CDuration dur(ddr);
+         dur.year += dr.year;  dur.month  += dr.month; dur.day    += dr.day;
          dur.hour += dr.hour;  dur.minute += dr.minute; dur.second += dr.second; dur.timestep += dr.timestep;
          return (dur);
       }
 
-      CDuration operator*(const CDuration & ddr , const double & scal)
+      CDuration operator*(const CDuration& ddr , const double& scal)
       {
          CDuration dur(ddr);
@@ -32,5 +32,5 @@
       }
 
-      CDuration operator-(const CDuration & ddr)
+      CDuration operator-(const CDuration& ddr)
       {
          CDuration dur(ddr);
@@ -47,74 +47,80 @@
       //-----------------------------------------------------------------
 
-      CDate operator+(const CDate & dt, const CDuration & dr)
-      {
-         CDuration drr (dr);
+      CDate operator+(const CDate& dt, const CDuration& dr)
+      {
+         CDuration drr(dr);
          int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
-         const CCalendar & c = dt.getRelCalendar();
-         
-         drr.timestep=0 ;       
-         drr=drr+dr.timestep*dt.getRelCalendar().getTimeStep() ;
-         
-         drr.resolve(dt.getRelCalendar());
+         const CCalendar& c = dt.getRelCalendar();
+
+         drr.timestep = 0;
+         if (dr.timestep)
+         {
+            if (c.getTimeStep() == NoneDu)
+               ERROR("operator+(const CDate& dt, const CDuration& dr)",
+                     << "Impossible to use the timestep before it is set.");
+            drr = drr + dr.timestep * c.getTimeStep();
+         }
+
+         drr.resolve(c);
 
          // Ajustement des minutes par rapport aux secondes.
          second += dt.getSecond() + drr.second;
-         if (second <  0) { minute --; second += c.getMinuteLength(); }
-         if (second >= c.getMinuteLength()) { minute ++; second -= c.getMinuteLength(); }
+         if (second < 0) { minute--; second += c.getMinuteLength(); }
+         if (second >= c.getMinuteLength()) { minute++; second -= c.getMinuteLength(); }
 
          // Ajustement des heures en fonction des minutes.
          minute += dt.getMinute() + drr.minute;
-         if (minute < 0) { hour --; minute += c.getHourLength(); }
-         if (minute >= c.getHourLength()) { hour ++; minute -= c.getHourLength(); }
+         if (minute < 0) { hour--; minute += c.getHourLength(); }
+         if (minute >= c.getHourLength()) { hour++; minute -= c.getHourLength(); }
 
          // Ajustement des jours en fonction des heures.
          hour += dt.getHour() + drr.hour;
-         if (hour <  0) { drr.day --; hour += c.getDayLength(); }
-         if (hour >= c.getDayLength()) { drr.day ++; hour -= c.getDayLength(); }
+         if (hour < 0) { drr.day--; hour += c.getDayLength(); }
+         if (hour >= c.getDayLength()) { drr.day++; hour -= c.getDayLength(); }
 
          // Ajustement des mois en fonction des jours.
-         CDate dtt(dt); 
-         drr.day+=dtt.getDay()-1 ;
-         dtt.setDay(1) ;         
-
-         if ( drr.day >= 0 )
-         {
-           for(; c.getMonthLength(dtt) <= drr.day; dtt.addMonth (1))
-           { drr.day -=  c.getMonthLength(dtt); drr.month += 1 ; }
-
-           day = drr.day+1 ;
-         }
-         else 
-         {
-           dtt.addMonth(-1) ;
-           drr.month-=1 ;
-           for(; c.getMonthLength(dtt) < -drr.day; dtt.addMonth (-1))
-           { drr.day+=c.getMonthLength(dtt) ; drr.month-=1 ; }
-           day=c.getMonthLength(dtt)+drr.day+1 ;
-         }
-            
+         CDate dtt(dt);
+         drr.day += dtt.getDay() - 1;
+         dtt.setDay(1);
+
+         if (drr.day >= 0)
+         {
+           for(; c.getMonthLength(dtt) <= drr.day; dtt.addMonth(1))
+           { drr.day -= c.getMonthLength(dtt); drr.month += 1; }
+
+           day = drr.day + 1;
+         }
+         else
+         {
+           dtt.addMonth(-1);
+           drr.month -= 1;
+           for(; c.getMonthLength(dtt) < -drr.day; dtt.addMonth(-1))
+           { drr.day += c.getMonthLength(dtt); drr.month -= 1; }
+           day = c.getMonthLength(dtt) + drr.day + 1;
+         }
+
 /*
          if (day <  0) { drr.month --; day += c.getMonthLength(dtt); }
          if (day > c.getMonthLength(dtt)) { drr.month ++; day -= c.getMonthLength(dtt); } // << ProblÃšme ici
          if (day == 0){ day = c.getMonthLength(dtt); drr.month --; }
-*/         
-         drr.resolve(dt.getRelCalendar());
+*/
+         drr.resolve(c);
 
          // Ajustement des annÃ©es en fonction des mois.
          month += dt.getMonth() + drr.month;
-         if (month <  0) { drr.year --; month += c.getYearLength(); }
-         if (month >  c.getYearLength()) { drr.year ++; month -= c.getYearLength(); }
+         if (month < 0) { drr.year--; month += c.getYearLength(); }
+         if (month > c.getYearLength()) { drr.year++; month -= c.getYearLength(); }
          if (month == 0){ month = c.getYearLength(); drr.year--; }
 
          year += dt.getYear() + drr.year;
 
-         return (CDate(dt.getRelCalendar(), year, month, day, hour, minute, second));
-      }
-
-      CDate operator-(const CDate & dt, const CDuration & dr) { return (dt + (-dr)); }
-
-      //-----------------------------------------------------------------
-
-      CDuration operator-(const CDate & dt0, const CDate & dt1)
+         return (CDate(c, year, month, day, hour, minute, second));
+      }
+
+      CDate operator-(const CDate& dt, const CDuration& dr) { return (dt + (-dr)); }
+
+      //-----------------------------------------------------------------
+
+      CDuration operator-(const CDate& dt0, const CDate& dt1)
       {
          // TODO :: VÃ©rifier que les deux dates (dt0 et dt1) ont une rÃ©fÃ©rence vers le mÃªme calendrier.
@@ -131,6 +137,6 @@
       bool operator==(const CDuration& ddr, const CDuration& dr)
       {
-         return ((ddr.year == dr.year) && (ddr.month  == dr.month)  && (dr.day    == ddr.day) &&
-                 (ddr.hour == dr.hour) && (ddr.minute == dr.minute) && (dr.second == ddr.second) &&
+         return ((ddr.year == dr.year)&& (ddr.month  == dr.month) && (dr.day    == ddr.day)&&
+                 (ddr.hour == dr.hour)&& (ddr.minute == dr.minute)&& (dr.second == ddr.second)&&
                  (ddr.timestep == dr.timestep));
       }
@@ -144,6 +150,6 @@
       {
          // TODO :: VÃ©rifier que les deux dates (dt0 et dt1) ont une rÃ©fÃ©rence vers le mÃªme calendrier.
-         return ((dt0.getYear() == dt1.getYear()) && (dt0.getMonth()  == dt1.getMonth())  && (dt1.getDay()    == dt0.getDay()) &&
-                 (dt0.getHour() == dt1.getHour()) && (dt0.getMinute() == dt1.getMinute()) && (dt1.getSecond() == dt0.getSecond()));
+         return ((dt0.getYear() == dt1.getYear())&& (dt0.getMonth()  == dt1.getMonth()) && (dt1.getDay()    == dt0.getDay())&&
+                 (dt0.getHour() == dt1.getHour())&& (dt0.getMinute() == dt1.getMinute())&& (dt1.getSecond() == dt0.getSecond()));
       }
 
@@ -152,9 +158,9 @@
          // TODO :: VÃ©rifier que les deux dates (dt0 et dt1) ont une rÃ©fÃ©rence vers le mÃªme calendrier.
          if   (dt0.getYear()  < dt1.getYear())
-         { 
+         {
             return true;
          }
          else if (dt0.getYear() == dt1.getYear())
-         { 
+         {
             if   (dt0.getMonth()  < dt1.getMonth())
             {
@@ -174,5 +180,5 @@
                   }
                   else if (dt0.getHour() == dt1.getHour())
-                  { 
+                  {
                      if   (dt0.getMinute()  < dt1.getMinute())
                      {
@@ -193,8 +199,8 @@
       //-----------------------------------------------------------------
 
-      bool operator!=(const CDate & dt0, const CDate & dt1){ return !(dt1 == dt0); }
-      bool operator> (const CDate & dt0, const CDate & dt1){ return (dt1 < dt0); }
-      bool operator>=(const CDate & dt0, const CDate & dt1){ return ((dt0 > dt1) || (dt1 == dt0)); }
-      bool operator<=(const CDate & dt0, const CDate & dt1){ return ((dt0 < dt1) || (dt1 == dt0)); }
+      bool operator!=(const CDate& dt0, const CDate& dt1){ return !(dt1 == dt0); }
+      bool operator> (const CDate& dt0, const CDate& dt1){ return (dt1 < dt0); }
+      bool operator>=(const CDate& dt0, const CDate& dt1){ return ((dt0 > dt1) || (dt1 == dt0)); }
+      bool operator<=(const CDate& dt0, const CDate& dt1){ return ((dt0 < dt1) || (dt1 == dt0)); }
 
       ///----------------------------------------------------------------
Index: XIOS/trunk/src/calendar_util.hpp
===================================================================
--- XIOS/trunk/src/calendar_util.hpp	(revision 546)
+++ XIOS/trunk/src/calendar_util.hpp	(revision 549)
@@ -11,14 +11,14 @@
       /// ////////////////////// DÃ©clarations ////////////////////// ///
 
-      CDuration operator*(const double    & scal, const CDuration & ddr);
-      CDuration operator-(const CDuration & ddr , const CDuration & dr);
-      CDuration operator+(const CDuration & ddr , const CDuration & dr);
-      CDuration operator*(const CDuration & ddr , const double    & scal);
-      CDuration operator-(const CDuration & ddr);
+      CDuration operator*(const double& scal,   const CDuration& ddr);
+      CDuration operator-(const CDuration& ddr, const CDuration& dr);
+      CDuration operator+(const CDuration& ddr, const CDuration& dr);
+      CDuration operator*(const CDuration& ddr, const double& scal);
+      CDuration operator-(const CDuration& ddr);
 
-      CDate operator+(const CDate & dt, const CDuration & dr); // Non testÃ©e.
-      CDate operator-(const CDate & dt, const CDuration & dr);
+      CDate operator+(const CDate& dt, const CDuration& dr); // Non testÃ©e.
+      CDate operator-(const CDate& dt, const CDuration& dr);
 
-      CDuration operator-(const CDate & dt0, const CDate & dt1);
+      CDuration operator-(const CDate& dt0, const CDate& dt1);
 
       /// Les opÃ©rateurs de comparaison. (Non testÃ©s pour le moment)
@@ -29,8 +29,8 @@
       bool operator< (const CDate& dt0, const CDate& dt1);
 
-      bool operator!=(const CDate & dt0, const CDate & dt1);
-      bool operator> (const CDate & dt0, const CDate & dt1);
-      bool operator>=(const CDate & dt0, const CDate & dt1);
-      bool operator<=(const CDate & dt0, const CDate & dt1);
+      bool operator!=(const CDate& dt0, const CDate& dt1);
+      bool operator> (const CDate& dt0, const CDate& dt1);
+      bool operator>=(const CDate& dt0, const CDate& dt1);
+      bool operator<=(const CDate& dt0, const CDate& dt1);
 
       ///---------------------------------------------------------------
Index: XIOS/trunk/src/config/calendar_type.conf
===================================================================
--- XIOS/trunk/src/config/calendar_type.conf	(revision 546)
+++ XIOS/trunk/src/config/calendar_type.conf	(revision 549)
@@ -1,19 +1,19 @@
 #ifdef __XMLIO_CAllLeapCalendar__
-   DECLARE_CALENDAR(AllLeap, calendar_type_attr::AllLeap)
+   DECLARE_CALENDAR(AllLeap, AllLeap)
 #endif //__XMLIO_CAllLeapCalendar__
 
 #ifdef __XMLIO_CD360Calendar__
-   DECLARE_CALENDAR(D360, calendar_type_attr::D360)
+   DECLARE_CALENDAR(D360, D360)
 #endif //__XMLIO_CD360Calendar__
 
 #ifdef __XMLIO_CGregorianCalendar__
-   DECLARE_CALENDAR(Gregorian, calendar_type_attr::Gregorian)
+   DECLARE_CALENDAR(Gregorian, Gregorian)
 #endif //__XMLIO_CGregorianCalendar__
 
 #ifdef __XMLIO_CJulianCalendar__
-   DECLARE_CALENDAR(Julian, calendar_type_attr::Julian)
+   DECLARE_CALENDAR(Julian, Julian)
 #endif //__XMLIO_CJulianCalendar__
 
 #ifdef __XMLIO_CNoLeapCalendar__
-   DECLARE_CALENDAR(NoLeap, calendar_type_attr::NoLeap)
+   DECLARE_CALENDAR(NoLeap, NoLeap)
 #endif //__XMLIO_CNoLeapCalendar__
Index: XIOS/trunk/src/config/calendar_wrapper_attribute.conf
===================================================================
--- XIOS/trunk/src/config/calendar_wrapper_attribute.conf	(revision 549)
+++ XIOS/trunk/src/config/calendar_wrapper_attribute.conf	(revision 549)
@@ -0,0 +1,6 @@
+DECLARE_ENUM5(type, D360, AllLeap, NoLeap, Julian, Gregorian)
+DECLARE_ATTRIBUTE(CDuration, timestep)
+// The start date and time origin are declared as string attributes instead
+// of CDate attributes so that we can control when they are parsed exactly
+DECLARE_ATTRIBUTE(string, start_date)
+DECLARE_ATTRIBUTE(string, time_origin)
Index: XIOS/trunk/src/config/context_attribute.conf
===================================================================
--- XIOS/trunk/src/config/context_attribute.conf	(revision 546)
+++ XIOS/trunk/src/config/context_attribute.conf	(revision 549)
@@ -1,6 +1,1 @@
-DECLARE_ENUM5(calendar_type, D360, AllLeap, NoLeap, Julian, Gregorian)
-DECLARE_ATTRIBUTE(CDate, start_date)
-DECLARE_ATTRIBUTE(CDate, time_origin)
-DECLARE_ATTRIBUTE(CDuration, timestep)
 DECLARE_ATTRIBUTE(StdString, output_dir)
-
Index: XIOS/trunk/src/config/node_type.conf
===================================================================
--- XIOS/trunk/src/config/node_type.conf	(revision 546)
+++ XIOS/trunk/src/config/node_type.conf	(revision 549)
@@ -27,4 +27,8 @@
 #endif //__XMLIO_CVariable__
 
+#ifdef __XMLIO_CCalendarWrapper__
+   DECLARE_NODE(CalendarWrapper, calendarwrapper)
+#endif //__XMLIO_CCalendarWrapper__
+
 #ifdef __XMLIO_CContext__
    DECLARE_NODE_PAR(Context, context)
Index: XIOS/trunk/src/context_server.cpp
===================================================================
--- XIOS/trunk/src/context_server.cpp	(revision 546)
+++ XIOS/trunk/src/context_server.cpp	(revision 549)
@@ -25,37 +25,37 @@
   CContextServer::CContextServer(CContext* parent,MPI_Comm intraComm_,MPI_Comm interComm_)
   {
-    context=parent ;
-    intraComm=intraComm_ ;
-    MPI_Comm_size(intraComm,&intraCommSize) ;
-    MPI_Comm_rank(intraComm,&intraCommRank) ;
-    interComm=interComm_ ;
-    int flag ;
-    MPI_Comm_test_inter(interComm,&flag) ;
+    context=parent;
+    intraComm=intraComm_;
+    MPI_Comm_size(intraComm,&intraCommSize);
+    MPI_Comm_rank(intraComm,&intraCommRank);
+    interComm=interComm_;
+    int flag;
+    MPI_Comm_test_inter(interComm,&flag);
     if (flag) MPI_Comm_remote_size(interComm,&commSize);
-    else  MPI_Comm_size(interComm,&commSize) ;
-    currentTimeLine=0 ;
-    scheduled=false ;
-    finished=false ;
-
-    boost::hash<string> hashString ;
-    hashId=hashString(context->getId()) ;
+    else  MPI_Comm_size(interComm,&commSize);
+    currentTimeLine=0;
+    scheduled=false;
+    finished=false;
+
+    boost::hash<string> hashString;
+    hashId=hashString(context->getId());
 
   }
   void CContextServer::setPendingEvent(void)
   {
-    pendingEvent=true ;
+    pendingEvent=true;
   }
 
   bool CContextServer::hasPendingEvent(void)
   {
-    return pendingEvent ;
+    return pendingEvent;
   }
 
   bool CContextServer::eventLoop(void)
   {
-    listen() ;
-    checkPendingRequest() ;
-    processEvents() ;
-    return finished ;
+    listen();
+    checkPendingRequest();
+    processEvents();
+    return finished;
   }
 
@@ -63,7 +63,7 @@
   {
     int rank;
-    int flag ;
-    int count ;
-    char * addr ;
+    int flag;
+    int count;
+    char * addr;
     MPI_Status status;
     map<int,CServerBuffer*>::iterator it;
@@ -73,10 +73,10 @@
       if (pendingRequest.find(rank)==pendingRequest.end())
       {
-        traceOff() ;
+        traceOff();
         MPI_Iprobe(rank,20,interComm,&flag,&status);
-        traceOn() ;
+        traceOn();
         if (flag==true)
         {
-          it=buffers.find(rank) ;
+          it=buffers.find(rank);
           if (it==buffers.end())
           {
@@ -84,14 +84,14 @@
             MPI_Recv(&buffSize, 1, MPI_LONG, rank, 20, interComm, &status);
             mapBufferSize_.insert(std::make_pair(rank, buffSize));
-            it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer(buffSize)))).first ;
+            it=(buffers.insert(pair<int,CServerBuffer*>(rank,new CServerBuffer(buffSize)))).first;
           }
           else
           {
-            MPI_Get_count(&status,MPI_CHAR,&count) ;
+            MPI_Get_count(&status,MPI_CHAR,&count);
             if (it->second->isBufferFree(count))
             {
-              addr=(char*)it->second->getBuffer(count) ;
-              MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]) ;
-              bufferRequest[rank]=addr ;
+              addr=(char*)it->second->getBuffer(count);
+              MPI_Irecv(addr,count,MPI_CHAR,rank,20,interComm,&pendingRequest[rank]);
+              bufferRequest[rank]=addr;
             }
           }
@@ -104,22 +104,22 @@
   {
     map<int,MPI_Request>::iterator it;
-    list<int> recvRequest ;
+    list<int> recvRequest;
     list<int>::iterator itRecv;
-    int rank ;
-    int flag ;
-    int count ;
-    MPI_Status status ;
+    int rank;
+    int flag;
+    int count;
+    MPI_Status status;
 
     for(it=pendingRequest.begin();it!=pendingRequest.end();it++)
     {
-      rank=it->first ;
-      traceOff() ;
-      MPI_Test(& it->second, &flag, &status) ;
-      traceOn() ;
+      rank=it->first;
+      traceOff();
+      MPI_Test(& it->second, &flag, &status);
+      traceOn();
       if (flag==true)
       {
-        recvRequest.push_back(rank) ;
-        MPI_Get_count(&status,MPI_CHAR,&count) ;
-        processRequest(rank,bufferRequest[rank],count) ;
+        recvRequest.push_back(rank);
+        MPI_Get_count(&status,MPI_CHAR,&count);
+        processRequest(rank,bufferRequest[rank],count);
       }
     }
@@ -127,6 +127,6 @@
     for(itRecv=recvRequest.begin();itRecv!=recvRequest.end();itRecv++)
     {
-      pendingRequest.erase(*itRecv) ;
-      bufferRequest.erase(*itRecv) ;
+      pendingRequest.erase(*itRecv);
+      bufferRequest.erase(*itRecv);
     }
   }
@@ -135,22 +135,22 @@
   {
 
-    CBufferIn buffer(buff,count) ;
-    char* startBuffer,endBuffer ;
-    int size, offset ;
-    size_t timeLine ;
-    map<size_t,CEventServer*>::iterator it ;
+    CBufferIn buffer(buff,count);
+    char* startBuffer,endBuffer;
+    int size, offset;
+    size_t timeLine;
+    map<size_t,CEventServer*>::iterator it;
 
     while(count>0)
     {
-      char* startBuffer=(char*)buffer.ptr() ;
-      CBufferIn newBuffer(startBuffer,buffer.remain()) ;
-      newBuffer>>size>>timeLine ;
-
-      it=events.find(timeLine) ;
-      if (it==events.end()) it=events.insert(pair<int,CEventServer*>(timeLine,new CEventServer)).first ;
-      it->second->push(rank,buffers[rank],startBuffer,size) ;
-
-      buffer.advance(size) ;
-      count=buffer.remain() ;
+      char* startBuffer=(char*)buffer.ptr();
+      CBufferIn newBuffer(startBuffer,buffer.remain());
+      newBuffer>>size>>timeLine;
+
+      it=events.find(timeLine);
+      if (it==events.end()) it=events.insert(pair<int,CEventServer*>(timeLine,new CEventServer)).first;
+      it->second->push(rank,buffers[rank],startBuffer,size);
+
+      buffer.advance(size);
+      count=buffer.remain();
     }
 
@@ -159,11 +159,11 @@
   void CContextServer::processEvents(void)
   {
-    map<size_t,CEventServer*>::iterator it ;
-    CEventServer* event ;
-
-    it=events.find(currentTimeLine) ;
+    map<size_t,CEventServer*>::iterator it;
+    CEventServer* event;
+
+    it=events.find(currentTimeLine);
     if (it!=events.end())
     {
-      event=it->second ;
+      event=it->second;
 
       if (event->isFull())
@@ -171,17 +171,17 @@
         if (!scheduled && !CXios::isServer)
         {
-          CServer::eventScheduler->registerEvent(currentTimeLine,hashId) ;
-          scheduled=true ;
+          CServer::eventScheduler->registerEvent(currentTimeLine,hashId);
+          scheduled=true;
         }
         else if (CXios::isServer || CServer::eventScheduler->queryEvent(currentTimeLine,hashId) )
         {
-         CTimer::get("Process events").resume() ;
-         dispatchEvent(*event) ;
-         CTimer::get("Process events").suspend() ;
-         pendingEvent=false ;
-         delete event ;
-         events.erase(it) ;
-         currentTimeLine++ ;
-         scheduled = false ;
+         CTimer::get("Process events").resume();
+         dispatchEvent(*event);
+         CTimer::get("Process events").suspend();
+         pendingEvent=false;
+         delete event;
+         events.erase(it);
+         currentTimeLine++;
+         scheduled = false;
         }
       }
@@ -191,6 +191,6 @@
   CContextServer::~CContextServer()
   {
-    map<int,CServerBuffer*>::iterator it ;
-    for(it=buffers.begin();it!=buffers.end();++it) delete it->second ;
+    map<int,CServerBuffer*>::iterator it;
+    for(it=buffers.begin();it!=buffers.end();++it) delete it->second;
   }
 
@@ -198,14 +198,14 @@
   void CContextServer::dispatchEvent(CEventServer& event)
   {
-    string contextName ;
-    string buff ;
-    int MsgSize ;
-    int rank ;
-    list<CEventServer::SSubEvent>::iterator it ;
-    CContext::setCurrent(context->getId()) ;
+    string contextName;
+    string buff;
+    int MsgSize;
+    int rank;
+    list<CEventServer::SSubEvent>::iterator it;
+    CContext::setCurrent(context->getId());
 
     if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE)
     {
-      info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl ;
+      info(20)<<"Server Side context <"<<context->getId()<<"> finalized"<<endl;
       std::map<int, StdSize>::const_iterator itbMap = mapBufferSize_.begin(),
                                              iteMap = mapBufferSize_.end(), itMap;
@@ -217,24 +217,25 @@
         totalBuf += itMap->second;
       }
-      context->finalize() ;
-      finished=true ;
-      report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl ;
-    }
-    else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event) ;
-    else if (event.classId==CContextGroup::GetType()) CContextGroup::dispatchEvent(event) ;
-    else if (event.classId==CDomain::GetType()) CDomain::dispatchEvent(event) ;
-    else if (event.classId==CDomainGroup::GetType()) CDomainGroup::dispatchEvent(event) ;
-    else if (event.classId==CAxis::GetType()) CAxis::dispatchEvent(event) ;
-    else if (event.classId==CAxisGroup::GetType()) CAxisGroup::dispatchEvent(event) ;
-    else if (event.classId==CGrid::GetType()) CGrid::dispatchEvent(event) ;
-    else if (event.classId==CGridGroup::GetType()) CGridGroup::dispatchEvent(event) ;
-    else if (event.classId==CField::GetType()) CField::dispatchEvent(event) ;
-    else if (event.classId==CFieldGroup::GetType()) CFieldGroup::dispatchEvent(event) ;
-    else if (event.classId==CFile::GetType()) CFile::dispatchEvent(event) ;
-    else if (event.classId==CFileGroup::GetType()) CFileGroup::dispatchEvent(event) ;
-    else if (event.classId==CVariable::GetType()) CVariable::dispatchEvent(event) ;
+      context->finalize();
+      finished=true;
+      report(0)<< " Memory report : Context <"<<context->getId()<<"> : server side : total memory used for buffer "<<totalBuf<<" bytes"<<endl;
+    }
+    else if (event.classId==CContext::GetType()) CContext::dispatchEvent(event);
+    else if (event.classId==CContextGroup::GetType()) CContextGroup::dispatchEvent(event);
+    else if (event.classId==CCalendarWrapper::GetType()) CCalendarWrapper::dispatchEvent(event);
+    else if (event.classId==CDomain::GetType()) CDomain::dispatchEvent(event);
+    else if (event.classId==CDomainGroup::GetType()) CDomainGroup::dispatchEvent(event);
+    else if (event.classId==CAxis::GetType()) CAxis::dispatchEvent(event);
+    else if (event.classId==CAxisGroup::GetType()) CAxisGroup::dispatchEvent(event);
+    else if (event.classId==CGrid::GetType()) CGrid::dispatchEvent(event);
+    else if (event.classId==CGridGroup::GetType()) CGridGroup::dispatchEvent(event);
+    else if (event.classId==CField::GetType()) CField::dispatchEvent(event);
+    else if (event.classId==CFieldGroup::GetType()) CFieldGroup::dispatchEvent(event);
+    else if (event.classId==CFile::GetType()) CFile::dispatchEvent(event);
+    else if (event.classId==CFileGroup::GetType()) CFileGroup::dispatchEvent(event);
+    else if (event.classId==CVariable::GetType()) CVariable::dispatchEvent(event);
     else
     {
-      ERROR("void CContextServer::dispatchEvent(CEventServer& event)",<<" Bad event class Id"<<endl) ;
+      ERROR("void CContextServer::dispatchEvent(CEventServer& event)",<<" Bad event class Id"<<endl);
     }
   }
Index: XIOS/trunk/src/date.cpp
===================================================================
--- XIOS/trunk/src/date.cpp	(revision 546)
+++ XIOS/trunk/src/date.cpp	(revision 549)
@@ -2,9 +2,10 @@
 #include "calendar.hpp"
 #include "calendar_type.hpp"
+#include "calendar_util.hpp"
 #include <boost/date_time/gregorian/gregorian.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
 
-using namespace boost::posix_time ;
-using namespace boost::gregorian ;
+using namespace boost::posix_time;
+using namespace boost::gregorian;
 
 namespace xios
@@ -12,23 +13,23 @@
       /// ////////////////////// DÃ©finitions ////////////////////// ///
       CDate::CDate(void)
-         : relCalendar(NULL)
-         , year(0), month(1) , day(1)
+        : relCalendar(NULL)
+        , year(0), month(1),  day(1)
+        , hour(0), minute(0), second(0)
+      {}
+
+      CDate::CDate(const CCalendar& calendar)
+         : relCalendar(&calendar)
+         , year(0), month(1),  day(1)
          , hour(0), minute(0), second(0)
       {}
 
-      CDate::CDate(const CCalendar& calendar)
-         : relCalendar(&calendar)
-         , year(0), month(1) , day(1)
-         , hour(0), minute(0), second(0)
-      {}
-      
       CDate::CDate(const CCalendar& calendar,
                    int yr, int mth, int d,
                    int hr, int min, int sec)
          : relCalendar(&calendar)
-         , year(yr), month(mth) , day(d)
+         , year(yr), month(mth),  day(d)
          , hour(hr), minute(min), second(sec)
       {
-         if(!this->checkDate())
+         if (!this->checkDate())
          {
             DEBUG(<< "La date initialisÃ©e a Ã©tÃ© modifiÃ©e "
@@ -38,7 +39,7 @@
 
       CDate::CDate(const CDate& date)
-            : relCalendar(date.relCalendar),
-              year(date.year), month(date.month)  , day(date.day),
-              hour(date.hour), minute(date.minute), second(date.second)
+        : relCalendar(date.relCalendar)
+        , year(date.year), month(date.month),   day(date.day)
+        , hour(date.hour), minute(date.minute), second(date.second)
       {
         // Delay the verification until we get a calendar we can compare the date to
@@ -55,65 +56,68 @@
       ///---------------------------------------------------------------
 
-      CDate & CDate::operator=(const CDate & date)
+      CDate& CDate::operator=(const CDate& date)
       {
          relCalendar = date.relCalendar;
-         year = date.year; month  = date.month ; day    = date.day;
+         year = date.year; month  = date.month; day    = date.day;
          hour = date.hour; minute = date.minute; second = date.second;
          return (*this);
       }
 
-      StdOStream & operator<<(StdOStream & out, const CDate & date)
-      {
-         std::streamsize s ; 
-         char c ;
-
-
-         int width=4 ;
-         double maxSize=10000 ;
-         while(date.year>=maxSize)
-         {
-           maxSize*=10 ;
-           width++ ;
-         }
-         s = out.width (width);  c = out.fill ('0') ; out << date.year << '-';
-
-         s = out.width (2);  c = out.fill ('0') ; out << date.month << '-';
-         s = out.width (2);  c = out.fill ('0') ; out << date.day << ' ';
-         s = out.width (2);  c = out.fill ('0') ; out << date.hour << ':';
-         s = out.width (2);  c = out.fill ('0') ; out << date.minute << ':';
-         s = out.width (2);  c = out.fill ('0') ; out << date.second ;
-
-         return (out);
-      }
-
-      StdIStream & operator>>(StdIStream & in, CDate & date) // Non testÃ©e.
+      StdOStream& operator<<(StdOStream& out, const CDate& date)
+      {
+        std::streamsize s;
+        char c;
+
+        int width=4;
+        double maxSize=10000;
+        while (date.year>=maxSize)
+        {
+          maxSize*=10;
+          width++;
+        }
+        s = out.width(width); c = out.fill('0'); out << date.year << '-';
+
+        s = out.width(2); c = out.fill('0'); out << date.month << '-';
+        s = out.width(2); c = out.fill('0'); out << date.day << ' ';
+        s = out.width(2); c = out.fill('0'); out << date.hour << ':';
+        s = out.width(2); c = out.fill('0'); out << date.minute << ':';
+        s = out.width(2); c = out.fill('0'); out << date.second;
+
+        return out;
+      }
+
+      StdIStream& operator>>(StdIStream& in, CDate& date) // Non testÃ©e.
       {
         char sep = '-'; // Le caractÃšre c est utilisÃ© pour "recueillir" les sÃ©parateurs "/" et ":".
-        char c ;
-         
-        in >> date.year >> c ;
-        if (c==sep)
+        char c;
+
+        // Default initialize the date
+        date.year = 0;
+        date.month = 1;
+        date.day = 1;
+        date.hour = 0;
+        date.minute = 0;
+        date.second = 0;
+
+        in >> date.year >> c;
+        if (c == sep)
         {
-          in >> date.month >> c ;
-          if (c==sep)
+          in >> date.month >> c;
+          if (c == sep)
           {
-            in >> date.day  ;
-            c=in.get();
-            sep=' ' ;
-            if (c==sep)
+            in >> date.day;
+            c = in.get();
+            sep = ' ';
+            if (c == sep)
             {
-              in >> date.hour >> c ;
-              sep=':' ;
-              if (c==sep) 
+              in >> date.hour >> c;
+              sep = ':';
+              if (c == sep)
               {
                 in>>date.minute >> c;
-                if (c==sep)
+                if (c == sep)
                 {
                   in >> date.second;
-                  // Delay the verification until we get a calendar we can compare the date to
-                  if (date.relCalendar && !date.checkDate())
-                    ERROR("StdIStream & operator >> (StdIStream & in, CDate & date)",
-                          << "Bad date format or not conform to calendar");
-                  return (in);
+                  in >> c;
                 }
               }
@@ -121,27 +125,41 @@
           }
         }
-        ERROR("StdIStream & operator >> (StdIStream & in, CDate & date)",<<"Bad date format or not conform to calendar" );
-        return (in);
+
+        // Delay the verification until we get a calendar we can compare the date to
+        if (date.relCalendar && !date.checkDate())
+          ERROR("StdIStream& operator >> (StdIStream& in, CDate& date)",
+                << "Bad date format or not conform to calendar");
+
+        if (c == '+') // We will be adding a duration to the date
+        {
+          CDuration dur;
+          in >> dur;
+          date = date + dur;
+        }
+        else if (!in.eof())
+          ERROR("StdIStream& operator >> (StdIStream& in, CDate& date)",
+                << "Invalid date format: unexpected trailing character(s)");
+
+        return in;
       }
 
       CDate::operator Time(void) const // Non vÃ©rifiÃ©e, pas optimisÃ©e ...
       {
-         // This will check that a calendar was correctly associated to the date
-         const CCalendar& c = getRelCalendar();
-
-         // Todo : Tester si la date courante est supÃ©rieure Ã  la date initiale.
-         Time retvalue = - c.getNbSecond(c.getTimeOrigin())
-                         + c.getNbSecond(*this);
-
-         if ((c.getId().compare("D360")    == 0) ||
-             (c.getId().compare("AllLeap") == 0) ||
-             (c.getId().compare("NoLeap")  == 0))
-         return (retvalue + (getYear() - c.getTimeOrigin().getYear())
-                                       * c.getYearTotalLength(*this));
-
-         for(CDate _d(c.getTimeOrigin());
-            _d.getYear() < getYear(); _d.setYear(_d.getYear()+1))
-            retvalue += c.getYearTotalLength(_d);
-         return (retvalue);
+        // This will check that a calendar was correctly associated to the date
+        const CCalendar& c = getRelCalendar();
+
+        // Todo : Tester si la date courante est supÃ©rieure Ã  la date initiale.
+        Time retvalue = getSecondOfYear() - c.getTimeOrigin().getSecondOfYear();
+
+        if ((c.getId().compare("D360")    == 0) ||
+            (c.getId().compare("AllLeap") == 0) ||
+            (c.getId().compare("NoLeap")  == 0))
+        return (retvalue + (getYear() - c.getTimeOrigin().getYear())
+                                      * c.getYearTotalLength(*this));
+
+        for (CDate _d(c.getTimeOrigin()); _d.getYear() < getYear(); _d.setYear(_d.getYear() + 1))
+           retvalue += c.getYearTotalLength(_d);
+
+        return retvalue;
       }
 
@@ -150,35 +168,35 @@
       bool CDate::checkDate(void)
       {
-         bool retValue = true;
-
-         // This will check that a calendar was correctly associated to the date
-         const CCalendar& c = getRelCalendar();
-
-         // VÃ©rification de la valeur du mois.
-         if (month  < 1) { retValue = false; month  = 1; }
-         if (month  > c.getYearLength())
-         { retValue = false; month = c.getYearLength(); }
-
-         // VÃ©rification de la valeur du jour.
-         if (day    < 1) { retValue = false; day  = 1; }
-         if (day    > c.getMonthLength(*this))
-         { retValue = false; day = c.getMonthLength(*this); }
-
-         // VÃ©rification de la valeur de l'heure.
-         if (hour   < 0) { retValue = false; hour  = 0; }
-         if (hour   >= c.getDayLength())
-         { retValue = false; hour = c.getDayLength() - 1; }
-
-         // VÃ©rification de la valeur des minutes.
-         if (minute < 0) { retValue = false; minute = 0; }
-         if (minute >= c.getHourLength())
-         { retValue = false; minute = c.getHourLength() - 1; }
-
-         // VÃ©rification de la valeur des secondes.
-         if (second < 0) { retValue = false; second = 0; }
-         if (second >= c.getMinuteLength())
-         { retValue = false; second = c.getMinuteLength() - 1; }
-
-         return retValue;
+        bool retValue = true;
+
+        // This will check that a calendar was correctly associated to the date
+        const CCalendar& c = getRelCalendar();
+
+        // VÃ©rification de la valeur du mois.
+        if (month  < 1) { retValue = false; month  = 1; }
+        if (month  > c.getYearLength())
+        { retValue = false; month = c.getYearLength(); }
+
+        // VÃ©rification de la valeur du jour.
+        if (day    < 1) { retValue = false; day  = 1; }
+        if (day    > c.getMonthLength(*this))
+        { retValue = false; day = c.getMonthLength(*this); }
+
+        // VÃ©rification de la valeur de l'heure.
+        if (hour   < 0) { retValue = false; hour  = 0; }
+        if (hour   >= c.getDayLength())
+        { retValue = false; hour = c.getDayLength() - 1; }
+
+        // VÃ©rification de la valeur des minutes.
+        if (minute < 0) { retValue = false; minute = 0; }
+        if (minute >= c.getHourLength())
+        { retValue = false; minute = c.getHourLength() - 1; }
+
+        // VÃ©rification de la valeur des secondes.
+        if (second < 0) { retValue = false; second = 0; }
+        if (second >= c.getMinuteLength())
+        { retValue = false; second = c.getMinuteLength() - 1; }
+
+        return retValue;
       }
 
@@ -207,4 +225,60 @@
       //----------------------------------------------------------------
 
+      /*!
+        Get the number of seconds since the beginning of the year.
+        \return the number of seconds since the beginning of the year.
+      */
+      int CDate::getSecondOfYear() const
+      {
+        CDate yearStart(*this);
+        const CCalendar& c = getRelCalendar();
+        int nbDay = 0;
+
+        for (yearStart.setMonth(1); yearStart.getMonth() < getMonth(); yearStart.setMonth(yearStart.getMonth() + 1))
+          nbDay += c.getMonthLength(yearStart);
+
+        return ((((nbDay + getDay() - 1) * c.getDayLength() + getHour()) * c.getHourLength()
+                   + getMinute()) * c.getMinuteLength() + getSecond());
+      }
+
+      /*!
+        Get the number of days (expressed as a real number) since the beginning of the year.
+        \return the number of days (expressed as a real number) since the beginning of the year.
+      */
+      double CDate::getDayOfYear() const
+      {
+        return double(getSecondOfYear()) / getRelCalendar().getDayLengthInSeconds();
+      }
+
+      /*!
+        Get the fraction of the current year as a real number between 0 and 1.
+        \return the fraction of the current year.
+      */
+      double CDate::getFractionOfYear() const
+      {
+        return double(getSecondOfYear()) / getRelCalendar().getYearTotalLength(*this);
+      }
+
+      /*!
+        Get the number of seconds since the beginning of the day.
+        \return the number of seconds since the beginning of the day.
+      */
+      int CDate::getSecondOfDay() const
+      {
+        const CCalendar& c = getRelCalendar();
+        return ((getHour() * c.getHourLength() + getMinute()) * c.getMinuteLength() + getSecond());
+      }
+
+      /*!
+        Get the fraction of the current day as a real number between 0 and 1.
+        \return the fraction of the current day.
+      */
+      double CDate::getFractionOfDay() const
+      {
+        return double(getSecondOfDay()) / getRelCalendar().getDayLengthInSeconds();
+      }
+
+      //----------------------------------------------------------------
+
       void CDate::setYear  (int newyear)   { this->year   = newyear; }
       void CDate::setMonth (int newmonth)  { this->month  = newmonth; }
@@ -226,9 +300,9 @@
       //----------------------------------------------------------------
 
-      void CDate::addMonth (int value)
+      void CDate::addMonth(int value)
       {// Value doit Ãªtre Ã©gale Ã  1 ou -1.
-         this->month += value;
-         if (this->month == 13) { year++; this->month = 1 ; }
-         if (this->month == 0 ) { year--; this->month = 12; }
+        this->month += value;
+        if (this->month == 13) { year++; this->month = 1; }
+        if (this->month == 0)  { year--; this->month = 12; }
       }
 
@@ -243,41 +317,40 @@
       //----------------------------------------------------------------
 
-      CDate CDate::FromString(const StdString & str, const CCalendar & calendar)
-      {
-         CDate dt(calendar);
-         StdIStringStream iss(str);
-         iss >> dt;
-         return dt;
-      }
-      
-      //----------------------------------------------------------------
-      
+      CDate CDate::FromString(const StdString& str, const CCalendar& calendar)
+      {
+        CDate dt(calendar);
+        StdIStringStream iss(str);
+        iss >> dt;
+        return dt;
+      }
+
+      //----------------------------------------------------------------
+
       StdString CDate::getStryyyymmdd(void) const
-      { 
-         std::streamsize s ; 
-         char c ;
-
-         ostringstream oss ;
-
-         s = oss.width (4);  c = oss.fill ('0') ; oss << year ;
-         s = oss.width (2);  c = oss.fill ('0') ; oss << month;
-         s = oss.width (2);  c = oss.fill ('0') ; oss << day ;
-
-         return oss.str();
-      }
-      
+      {
+        std::streamsize s;
+        char c;
+
+        ostringstream oss;
+
+        s = oss.width(4); c = oss.fill('0'); oss << year;
+        s = oss.width(2); c = oss.fill('0'); oss << month;
+        s = oss.width(2); c = oss.fill('0'); oss << day;
+
+        return oss.str();
+      }
 
       string CDate::getStr(const string& str) const
       {
-        ostringstream oss ;
+        ostringstream oss;
         int level;
-        
-        level=0 ;
+
+        level=0;
         for(string::const_iterator it=str.begin();it!=str.end();++it)
         {
           if (level==0)
           {
-            if (*it=='%') level++ ;
-            else oss<<*it ;
+            if (*it=='%') level++;
+            else oss<<*it;
           }
           else if (level==1)
@@ -286,25 +359,33 @@
             {
               case 'y' :
-                oss.width (4);  oss.fill ('0') ; oss << year ;
-                level=0 ;
-                break ;
+                oss.width(4); oss.fill('0'); oss << year;
+                level=0;
+                break;
               case 'm' : // month or minute
-                level++ ;
-                break ;
+                level++;
+                break;
               case 'd' :
-                oss.width (2);  oss.fill ('0') ; oss << day ;
-                level=0;
-                break ;
+                oss.width(2); oss.fill('0'); oss << day;
+                level=0;
+                break;
               case 'h' :
-                oss.width (2);  oss.fill ('0') ; oss << hour ;
-                level=0;
-                break ;
+                oss.width(2); oss.fill('0'); oss << hour;
+                level=0;
+                break;
               case 's' :
-                oss.width (2);  oss.fill ('0') ; oss << second ;
-                level=0 ;
+                oss.width(2); oss.fill('0'); oss << second;
+                level=0;
+                break;
+              case 'S' : // seconds since time origin
+                oss.width(0); oss << Time(*this);
+                level=0;
+                break;
+              case 'D' : // days since time origin
+                oss.width(0); oss << Time(*this) / getRelCalendar().getDayLengthInSeconds();
+                level=0;
                 break;
               default :
-                oss<<'%'<<*it ;
-                level=0 ;
+                oss<<'%'<<*it;
+                level=0;
             }
           }
@@ -314,14 +395,14 @@
             {
               case 'o' : // month
-                oss.width (2);  oss.fill ('0') ; oss << month ;
-                level=0 ;
-                break ;
+                oss.width(2); oss.fill('0'); oss << month;
+                level=0;
+                break;
               case 'i' : //minute
-                oss.width (2);  oss.fill ('0') ; oss << minute ;
-                level=0 ;
-                break ;
+                oss.width(2); oss.fill('0'); oss << minute;
+                level=0;
+                break;
               default :
-                oss<<"%m"<<*it ;
-                level=0 ;
+                oss<<"%m"<<*it;
+                level=0;
             }
           }
@@ -329,10 +410,10 @@
         return oss.str();
       }
-      
+
       StdString CDate::toString(void) const
-      { 
-         StdOStringStream oss;
-         oss << (*this);
-         return (oss.str()); 
+      {
+        StdOStringStream oss;
+        oss << *this;
+        return oss.str();
       }
 
Index: XIOS/trunk/src/date.hpp
===================================================================
--- XIOS/trunk/src/date.hpp	(revision 546)
+++ XIOS/trunk/src/date.hpp	(revision 549)
@@ -20,10 +20,10 @@
             CDate(void);
             //!< Create an empty date associated to the specified calendar
-            CDate(const CCalendar & cal);
+            CDate(const CCalendar& cal);
             //!< Create a date associated to the specified calendar
-            CDate(const CCalendar & cal, int yr, int mth, int d,
-                                         int hr = 0, int min = 0, int sec = 0);
-            CDate(const CDate & odate);
-            CDate(const CDate * const odate); // Not implemented yet
+            CDate(const CCalendar& cal, int yr, int mth, int d,
+                                        int hr = 0, int min = 0, int sec = 0);
+            CDate(const CDate& odate);
+            CDate(const CDate* const odate); // Not implemented yet
 
             /// Destructeur ///
@@ -31,7 +31,7 @@
 
             /// OpÃ©rateurs ///
-            CDate & operator=(const CDate & date);
-            friend StdOStream & operator<<(StdOStream & out, const CDate & date);
-            friend StdIStream & operator>>(StdIStream & in, CDate & date); // Non testÃ©e.
+            CDate& operator=(const CDate& date);
+            friend StdOStream& operator<<(StdOStream& out, const CDate& date);
+            friend StdIStream& operator>>(StdIStream& in, CDate& date); // Non testÃ©e.
 
             //!< Return the number of seconds since the time origin fixed when creating the calendar
@@ -52,4 +52,15 @@
             const CCalendar& getRelCalendar(void) const;
             bool hasRelCalendar(void) const;
+
+            //!< Get the number of seconds since the beginning of the year
+            int getSecondOfYear() const;
+            //!< Get the number of days (expressed as a real number) since the beginning of the year
+            double getDayOfYear() const;
+            //!< Get the fraction of the current year as a real number between 0 and 1
+            double getFractionOfYear() const;
+            //!< Get the number of seconds since the beginning of the day
+            int getSecondOfDay() const;
+            //!< Get the fraction of the current day as a real number between 0 and 1
+            double getFractionOfDay() const;
 
             /// Mutateurs ///
@@ -77,5 +88,5 @@
          public : /* static */
 
-            static CDate FromString(const StdString & str, const CCalendar & calendar);
+            static CDate FromString(const StdString& str, const CCalendar& calendar);
 
          private :
Index: XIOS/trunk/src/date/d360.hpp
===================================================================
--- XIOS/trunk/src/date/d360.hpp	(revision 546)
+++ XIOS/trunk/src/date/d360.hpp	(revision 549)
@@ -17,5 +17,5 @@
 
             /// Constructeur ///
-            CD360Calendar(void);                                   // Not implemented yet.
+            //CD360Calendar(void);                                   // Not implemented yet.
             CD360Calendar(const CDate& startDate);
             CD360Calendar(const CDate& startDate, const CDate& timeOrigin);
Index: XIOS/trunk/src/generate_fortran_interface.cpp
===================================================================
--- XIOS/trunk/src/generate_fortran_interface.cpp	(revision 546)
+++ XIOS/trunk/src/generate_fortran_interface.cpp	(revision 549)
@@ -10,187 +10,201 @@
 int main (int argc, char ** argv, char ** UNUSED (env))
 {
-//  string path="./src/attr_interface/" ;
-  string path="./interface/" ;
-  
-  CContext* context=CContext::create("interface") ;
-  CAxis axis ;
-  CAxisGroup axisgroup ;
+//  string path="./src/attr_interface/";
+  string path="./interface/";
+
+  CContext* context=CContext::create("interface");
+  CCalendarWrapper calendarWrapper;
+  CAxis axis;
+  CAxisGroup axisgroup;
   CField field;
-  CFieldGroup fieldgroup ;
+  CFieldGroup fieldgroup;
   CVariable variable;
-  CVariableGroup variablegroup ;
-  CDomain domain ;
-  CDomainGroup domaingroup ;
-  CGrid grid ;
-  CGridGroup gridgroup ;
-  
+  CVariableGroup variablegroup;
+  CDomain domain;
+  CDomainGroup domaingroup;
+  CGrid grid;
+  CGridGroup gridgroup;
+
   CFile afile;
   CFileGroup filegroup;
-  
-  ostringstream oss ;
+
+  ostringstream oss;
   ofstream file;
-  
-  file.open((path+"axis_interface_attr.F90").c_str()); 
-  axis.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icaxis_attr.cpp").c_str()); 
-  axis.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"iaxis_attr.F90").c_str()); 
-  axis.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"axisgroup_interface_attr.F90").c_str()); 
-  axisgroup.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icaxisgroup_attr.cpp").c_str()); 
-  axisgroup.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"iaxisgroup_attr.F90").c_str()); 
-  axisgroup.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"domain_interface_attr.F90").c_str()); 
-  domain.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icdomain_attr.cpp").c_str()); 
-  domain.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"idomain_attr.F90").c_str()); 
-  domain.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"domaingroup_interface_attr.F90").c_str()); 
-  domaingroup.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icdomaingroup_attr.cpp").c_str()); 
-  domaingroup.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"idomaingroup_attr.F90").c_str()); 
-  domaingroup.generateFortranInterface(file) ;
-  file.close();
-  
-  
-  file.open((path+"grid_interface_attr.F90").c_str()); 
-  grid.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icgrid_attr.cpp").c_str()); 
-  grid.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"igrid_attr.F90").c_str()); 
-  grid.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"gridgroup_interface_attr.F90").c_str()); 
-  gridgroup.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icgridgroup_attr.cpp").c_str()); 
-  gridgroup.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"igridgroup_attr.F90").c_str()); 
-  gridgroup.generateFortranInterface(file) ;
-  file.close();
-  
-  
-  file.open((path+"field_interface_attr.F90").c_str()); 
-  field.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icfield_attr.cpp").c_str()); 
-  field.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"ifield_attr.F90").c_str()); 
-  field.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"fieldgroup_interface_attr.F90").c_str()); 
-  fieldgroup.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icfieldgroup_attr.cpp").c_str()); 
-  fieldgroup.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"ifieldgroup_attr.F90").c_str()); 
-  fieldgroup.generateFortranInterface(file) ;
-  file.close();
-  
-
-
-  file.open((path+"variable_interface_attr.F90").c_str()); 
-  variable.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icvariable_attr.cpp").c_str()); 
-  variable.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"ivariable_attr.F90").c_str()); 
-  variable.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"variablegroup_interface_attr.F90").c_str()); 
-  variablegroup.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icvariablegroup_attr.cpp").c_str()); 
-  variablegroup.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"ivariablegroup_attr.F90").c_str()); 
-  variablegroup.generateFortranInterface(file) ;
-  file.close();
-
-
-
-  file.open((path+"file_interface_attr.F90").c_str()); 
-  afile.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icfile_attr.cpp").c_str()); 
-  afile.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"ifile_attr.F90").c_str()); 
-  afile.generateFortranInterface(file) ;
-  file.close();
-  
-  file.open((path+"filegroup_interface_attr.F90").c_str()); 
-  filegroup.generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"icfilegroup_attr.cpp").c_str()); 
-  filegroup.generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"ifilegroup_attr.F90").c_str()); 
-  filegroup.generateFortranInterface(file) ;
-  file.close();
-  
- 
-  file.open((path+"context_interface_attr.F90").c_str()); 
-  context->generateFortran2003Interface(file) ;
-  file.close();
-  
-  file.open((path+"iccontext_attr.cpp").c_str()); 
-  context->generateCInterface(file) ;
-  file.close();
-  
-  file.open((path+"icontext_attr.F90").c_str()); 
-  context->generateFortranInterface(file) ;
-  file.close();
-  
+
+  file.open((path+"axis_interface_attr.F90").c_str());
+  axis.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icaxis_attr.cpp").c_str());
+  axis.generateCInterface(file);
+  file.close();
+
+  file.open((path+"iaxis_attr.F90").c_str());
+  axis.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"axisgroup_interface_attr.F90").c_str());
+  axisgroup.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icaxisgroup_attr.cpp").c_str());
+  axisgroup.generateCInterface(file);
+  file.close();
+
+  file.open((path+"iaxisgroup_attr.F90").c_str());
+  axisgroup.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"domain_interface_attr.F90").c_str());
+  domain.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icdomain_attr.cpp").c_str());
+  domain.generateCInterface(file);
+  file.close();
+
+  file.open((path+"idomain_attr.F90").c_str());
+  domain.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"domaingroup_interface_attr.F90").c_str());
+  domaingroup.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icdomaingroup_attr.cpp").c_str());
+  domaingroup.generateCInterface(file);
+  file.close();
+
+  file.open((path+"idomaingroup_attr.F90").c_str());
+  domaingroup.generateFortranInterface(file);
+  file.close();
+
+
+  file.open((path+"grid_interface_attr.F90").c_str());
+  grid.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icgrid_attr.cpp").c_str());
+  grid.generateCInterface(file);
+  file.close();
+
+  file.open((path+"igrid_attr.F90").c_str());
+  grid.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"gridgroup_interface_attr.F90").c_str());
+  gridgroup.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icgridgroup_attr.cpp").c_str());
+  gridgroup.generateCInterface(file);
+  file.close();
+
+  file.open((path+"igridgroup_attr.F90").c_str());
+  gridgroup.generateFortranInterface(file);
+  file.close();
+
+
+  file.open((path+"field_interface_attr.F90").c_str());
+  field.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icfield_attr.cpp").c_str());
+  field.generateCInterface(file);
+  file.close();
+
+  file.open((path+"ifield_attr.F90").c_str());
+  field.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"fieldgroup_interface_attr.F90").c_str());
+  fieldgroup.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icfieldgroup_attr.cpp").c_str());
+  fieldgroup.generateCInterface(file);
+  file.close();
+
+  file.open((path+"ifieldgroup_attr.F90").c_str());
+  fieldgroup.generateFortranInterface(file);
+  file.close();
+
+
+
+  file.open((path+"variable_interface_attr.F90").c_str());
+  variable.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icvariable_attr.cpp").c_str());
+  variable.generateCInterface(file);
+  file.close();
+
+  file.open((path+"ivariable_attr.F90").c_str());
+  variable.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"variablegroup_interface_attr.F90").c_str());
+  variablegroup.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icvariablegroup_attr.cpp").c_str());
+  variablegroup.generateCInterface(file);
+  file.close();
+
+  file.open((path+"ivariablegroup_attr.F90").c_str());
+  variablegroup.generateFortranInterface(file);
+  file.close();
+
+
+
+  file.open((path+"file_interface_attr.F90").c_str());
+  afile.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icfile_attr.cpp").c_str());
+  afile.generateCInterface(file);
+  file.close();
+
+  file.open((path+"ifile_attr.F90").c_str());
+  afile.generateFortranInterface(file);
+  file.close();
+
+  file.open((path+"filegroup_interface_attr.F90").c_str());
+  filegroup.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"icfilegroup_attr.cpp").c_str());
+  filegroup.generateCInterface(file);
+  file.close();
+
+  file.open((path+"ifilegroup_attr.F90").c_str());
+  filegroup.generateFortranInterface(file);
+  file.close();
+
+
+  file.open((path+"calendar_wrapper_interface_attr.F90").c_str());
+  calendarWrapper.generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"iccalendar_wrapper_attr.cpp").c_str());
+  calendarWrapper.generateCInterface(file);
+  file.close();
+
+  file.open((path+"icalendar_wrapper_attr.F90").c_str());
+  calendarWrapper.generateFortranInterface(file);
+  file.close();
+
+
+  file.open((path+"context_interface_attr.F90").c_str());
+  context->generateFortran2003Interface(file);
+  file.close();
+
+  file.open((path+"iccontext_attr.cpp").c_str());
+  context->generateCInterface(file);
+  file.close();
+
+  file.open((path+"icontext_attr.F90").c_str());
+  context->generateFortranInterface(file);
+  file.close();
+
 }
Index: XIOS/trunk/src/interface/c/iccalendar.cpp
===================================================================
--- XIOS/trunk/src/interface/c/iccalendar.cpp	(revision 546)
+++ XIOS/trunk/src/interface/c/iccalendar.cpp	(revision 549)
@@ -1,4 +1,5 @@
 #include "xmlioserver.hpp"
 
+#include "icdate.hpp"
 #include "exception.hpp"
 #include "timer.hpp"
@@ -8,13 +9,4 @@
 extern "C"
 {
-  void cxios_create_calendar()
-  {
-    CTimer::get("XIOS").resume();
-    xios::CContext* context = CContext::getCurrent();
-    if (context->hasClient)
-      context->solveCalendar();
-    CTimer::get("XIOS").suspend();
-  }
-
   void cxios_update_calendar(int step)
   {
@@ -26,3 +18,47 @@
     CTimer::get("XIOS").suspend();
   }
+
+  void cxios_get_current_date(cxios_date* current_date_c)
+  {
+    CTimer::get("XIOS").resume();
+    const xios::CContext* context = CContext::getCurrent();
+    const boost::shared_ptr<xios::CCalendar> cal = context->getCalendar();
+    if (!cal)
+      ERROR("void cxios_get_current_date(cxios_date* current_date_c)",
+            << "Impossible to get the current date: no calendar was defined.");
+    const CDate& currentDate = cal->getCurrentDate();
+    current_date_c->year = currentDate.getYear();
+    current_date_c->month = currentDate.getMonth();
+    current_date_c->day = currentDate.getDay();
+    current_date_c->hour = currentDate.getHour();
+    current_date_c->minute = currentDate.getMinute();
+    current_date_c->second = currentDate.getSecond();
+    CTimer::get("XIOS").suspend();
+  }
+
+  int cxios_get_year_length_in_seconds(int year)
+  {
+    CTimer::get("XIOS").resume();
+    const boost::shared_ptr<xios::CCalendar> cal = CContext::getCurrent()->getCalendar();
+    if (!cal)
+      ERROR("int cxios_get_year_length_in_seconds(int year)",
+            << "Impossible to get the year length: no calendar was defined.");
+    int length = cal->getYearTotalLength(CDate(*cal, year, 01, 01));
+    CTimer::get("XIOS").suspend();
+
+    return length;
+  }
+
+  int cxios_get_day_length_in_seconds()
+  {
+    CTimer::get("XIOS").resume();
+    const boost::shared_ptr<xios::CCalendar> cal = CContext::getCurrent()->getCalendar();
+    if (!cal)
+      ERROR("int cxios_get_day_length_in_seconds()",
+            << "Impossible to get the day length: no calendar was defined.");
+    int length = cal->getDayLengthInSeconds();
+    CTimer::get("XIOS").suspend();
+
+    return length;
+  }
 }
Index: XIOS/trunk/src/interface/c/iccalendar_wrapper.cpp
===================================================================
--- XIOS/trunk/src/interface/c/iccalendar_wrapper.cpp	(revision 549)
+++ XIOS/trunk/src/interface/c/iccalendar_wrapper.cpp	(revision 549)
@@ -0,0 +1,127 @@
+/* ************************************************************************** *
+ *      Copyright Â© IPSL/LSCE, xios, Avril 2010 - Octobre 2011         *
+ * ************************************************************************** */
+
+#include <boost/multi_array.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include "xmlioserver.hpp"
+
+#include "attribute_template.hpp"
+#include "object_template.hpp"
+#include "group_template.hpp"
+
+#include "icutil.hpp"
+#include "icdate.hpp"
+#include "timer.hpp"
+#include "calendar_wrapper.hpp"
+
+extern "C"
+{
+// /////////////////////////////// DÃ©finitions ////////////////////////////// //
+
+  // ----------------------- RedÃ©finition de type ----------------------------
+
+  typedef xios::CCalendarWrapper *XCalendarWrapperPtr;
+
+  // ------------------------ CrÃ©ation des handle -----------------------------
+
+  void cxios_calendar_wrapper_handle_create(XCalendarWrapperPtr* _ret, const char* _id, int _id_len)
+  {
+    std::string id;
+    if (!cstr2string(_id, _id_len, id)) return;
+    CTimer::get("XIOS").resume();
+    *_ret = CCalendarWrapper::get(id);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_current_calendar_wrapper(XCalendarWrapperPtr* _ret)
+  {
+    CTimer::get("XIOS").resume();
+    *_ret = CCalendarWrapper::get(CCalendarWrapper::GetDefName());
+    CTimer::get("XIOS").suspend();
+  }
+
+  // -------------------- VÃ©rification des identifiants -----------------------
+
+  void cxios_calendar_wrapper_valid_id(bool* _ret, const char* _id, int _id_len)
+  {
+    std::string id;
+    if (!cstr2string(_id, _id_len, id)) return;
+    CTimer::get("XIOS").resume();
+    *_ret = CCalendarWrapper::has(id);
+    CTimer::get("XIOS").suspend();
+  }
+
+  // ----------------------- Custom getters and setters -----------------------
+
+  void cxios_set_calendar_wrapper_date_start_date(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date start_date_c)
+  {
+    CTimer::get("XIOS").resume();
+    CDate start_date(*calendarWrapper_hdl->getCalendar(true),
+                     start_date_c.year,
+                     start_date_c.month,
+                     start_date_c.day,
+                     start_date_c.hour,
+                     start_date_c.minute,
+                     start_date_c.second);
+    calendarWrapper_hdl->setInitDate(start_date);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_calendar_wrapper_date_start_date(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date* start_date_c)
+  {
+    CTimer::get("XIOS").resume();
+    const CDate& start_date = calendarWrapper_hdl->getInitDate();
+    start_date_c->year = start_date.getYear();
+    start_date_c->month = start_date.getMonth();
+    start_date_c->day = start_date.getDay();
+    start_date_c->hour = start_date.getHour();
+    start_date_c->minute = start_date.getMinute();
+    start_date_c->second = start_date.getSecond();
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_set_calendar_wrapper_date_time_origin(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date time_origin_c)
+  {
+    CTimer::get("XIOS").resume();
+    CDate time_origin(*calendarWrapper_hdl->getCalendar(true),
+                      time_origin_c.year,
+                      time_origin_c.month,
+                      time_origin_c.day,
+                      time_origin_c.hour,
+                      time_origin_c.minute,
+                      time_origin_c.second);
+    calendarWrapper_hdl->setTimeOrigin(time_origin);
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_get_calendar_wrapper_date_time_origin(XCalendarWrapperPtr calendarWrapper_hdl, cxios_date* time_origin_c)
+  {
+    CTimer::get("XIOS").resume();
+    const CDate& time_origin = calendarWrapper_hdl->getTimeOrigin();
+    time_origin_c->year = time_origin.getYear();
+    time_origin_c->month = time_origin.getMonth();
+    time_origin_c->day = time_origin.getDay();
+    time_origin_c->hour = time_origin.getHour();
+    time_origin_c->minute = time_origin.getMinute();
+    time_origin_c->second = time_origin.getSecond();
+    CTimer::get("XIOS").suspend();
+  }
+
+  // ----------------------- Calendar creation and update ----------------------
+
+  void cxios_create_calendar(XCalendarWrapperPtr calendarWrapper_hdl)
+  {
+    CTimer::get("XIOS").resume();
+    calendarWrapper_hdl->createCalendar();
+    CTimer::get("XIOS").suspend();
+  }
+
+  void cxios_update_calendar_timestep(XCalendarWrapperPtr calendarWrapper_hdl)
+  {
+    CTimer::get("XIOS").resume();
+    calendarWrapper_hdl->updateTimestep();
+    CTimer::get("XIOS").suspend();
+  }
+} // extern "C"
Index: XIOS/trunk/src/interface/c/icdate.cpp
===================================================================
--- XIOS/trunk/src/interface/c/icdate.cpp	(revision 546)
+++ XIOS/trunk/src/interface/c/icdate.cpp	(revision 549)
@@ -144,3 +144,43 @@
     return (date1 >= date2);
   }
+
+  int cxios_date_get_second_of_year(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_second_of_year(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getSecondOfYear();
+  }
+
+  double cxios_date_get_day_of_year(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_day_of_year(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getDayOfYear();
+  }
+
+  double cxios_date_get_fraction_of_year(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_fraction_of_year(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getFractionOfYear();
+  }
+
+  int cxios_date_get_second_of_day(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_second_of_day(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getSecondOfDay();
+  }
+
+  double cxios_date_get_fraction_of_day(cxios_date date_c)
+  {
+    xios::CDate date = xios::CDate(getCalendar("int cxios_date_get_fraction_of_day(cxios_date date_c)"),
+                                   date_c.year, date_c.month, date_c.day,
+                                   date_c.hour, date_c.minute, date_c.second);
+    return date.getFractionOfDay();
+  }
 } // extern "C"
Index: XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp
===================================================================
--- XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp	(revision 549)
+++ XIOS/trunk/src/interface/c_attr/iccalendar_wrapper_attr.cpp	(revision 549)
@@ -0,0 +1,137 @@
+/* ************************************************************************** *
+ *               Interface auto generated - do not modify                   *
+ * ************************************************************************** */
+
+#include <boost/multi_array.hpp>
+#include <boost/shared_ptr.hpp>
+#include "xmlioserver.hpp"
+#include "attribute_template.hpp"
+#include "object_template.hpp"
+#include "group_template.hpp"
+#include "icutil.hpp"
+#include "icdate.hpp"
+#include "timer.hpp"
+#include "node_type.hpp"
+
+extern "C"
+{
+  typedef xios::CCalendarWrapper*  calendar_wrapper_Ptr;
+  
+  void cxios_set_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * start_date, int start_date_size)
+  {
+    std::string start_date_str;
+    if(!cstr2string(start_date, start_date_size, start_date_str)) return;
+     CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->start_date.setValue(start_date_str);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, char * start_date, int start_date_size)
+  {
+     CTimer::get("XIOS").resume();
+    if(!string_copy(calendar_wrapper_hdl->start_date.getInheritedValue(),start_date , start_date_size))
+      ERROR("void cxios_get_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl, char * start_date, int start_date_size)", <<"Input string is to short");
+     CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->start_date.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  void cxios_set_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * time_origin, int time_origin_size)
+  {
+    std::string time_origin_str;
+    if(!cstr2string(time_origin, time_origin_size, time_origin_str)) return;
+     CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->time_origin.setValue(time_origin_str);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, char * time_origin, int time_origin_size)
+  {
+     CTimer::get("XIOS").resume();
+    if(!string_copy(calendar_wrapper_hdl->time_origin.getInheritedValue(),time_origin , time_origin_size))
+      ERROR("void cxios_get_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl, char * time_origin, int time_origin_size)", <<"Input string is to short");
+     CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->time_origin.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  void cxios_set_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl, cxios_duration timestep_c)
+  {
+    CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->timestep.allocate();
+    CDuration& timestep = calendar_wrapper_hdl->timestep.get();
+    timestep.year = timestep_c.year;
+    timestep.month = timestep_c.month;
+    timestep.day = timestep_c.day;
+    timestep.hour = timestep_c.hour;
+    timestep.minute = timestep_c.minute;
+    timestep.second = timestep_c.second;
+    timestep.timestep = timestep_c.timestep;
+    CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl, cxios_duration* timestep_c)
+  {
+    CTimer::get("XIOS").resume();
+    CDuration timestep = calendar_wrapper_hdl->timestep.getInheritedValue();
+    timestep_c->year = timestep.year;
+    timestep_c->month = timestep.month;
+    timestep_c->day = timestep.day;
+    timestep_c->hour = timestep.hour;
+    timestep_c->minute = timestep.minute;
+    timestep_c->second = timestep.second;
+    timestep_c->timestep = timestep.timestep;
+    CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->timestep.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  void cxios_set_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, const char * type, int type_size)
+  {
+    std::string type_str;
+    if(!cstr2string(type, type_size, type_str)) return;
+     CTimer::get("XIOS").resume();
+    calendar_wrapper_hdl->type.fromString(type_str);
+     CTimer::get("XIOS").suspend();
+  }
+  
+  void cxios_get_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, char * type, int type_size)
+  {
+     CTimer::get("XIOS").resume();
+    if(!string_copy(calendar_wrapper_hdl->type.getInheritedStringValue(),type , type_size))
+      ERROR("void cxios_get_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl, char * type, int type_size)", <<"Input string is to short");
+     CTimer::get("XIOS").suspend();
+  }
+  
+  bool cxios_is_defined_calendar_wrapper_type(calendar_wrapper_Ptr calendar_wrapper_hdl )
+  {
+     CTimer::get("XIOS").resume();
+    return calendar_wrapper_hdl->type.hasInheritedValue();
+     CTimer::get("XIOS").suspend();
+  }
+  
+  
+  
+  
+}
Index: XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp
===================================================================
--- XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp	(revision 546)
+++ XIOS/trunk/src/interface/c_attr/iccontext_attr.cpp	(revision 549)
@@ -17,30 +17,4 @@
 {
   typedef xios::CContext*  context_Ptr;
-  
-  void cxios_set_context_calendar_type(context_Ptr context_hdl, const char * calendar_type, int calendar_type_size)
-  {
-    std::string calendar_type_str;
-    if(!cstr2string(calendar_type, calendar_type_size, calendar_type_str)) return;
-     CTimer::get("XIOS").resume();
-    context_hdl->calendar_type.fromString(calendar_type_str);
-     CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_calendar_type(context_Ptr context_hdl, char * calendar_type, int calendar_type_size)
-  {
-     CTimer::get("XIOS").resume();
-    if(!string_copy(context_hdl->calendar_type.getInheritedStringValue(),calendar_type , calendar_type_size))
-      ERROR("void cxios_get_context_calendar_type(context_Ptr context_hdl, char * calendar_type, int calendar_type_size)", <<"Input string is to short");
-     CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_calendar_type(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->calendar_type.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
   
   void cxios_set_context_output_dir(context_Ptr context_hdl, const char * output_dir, int output_dir_size)
@@ -70,118 +44,4 @@
   
   
-  void cxios_set_context_start_date(context_Ptr context_hdl, cxios_date start_date_c)
-  {
-    CTimer::get("XIOS").resume();
-    context_hdl->start_date.allocate();
-    CDate& start_date = context_hdl->start_date.get();
-    start_date.setDate(start_date_c.year,
-                           start_date_c.month,
-                           start_date_c.day,
-                           start_date_c.hour,
-                           start_date_c.minute,
-                           start_date_c.second);
-    if (start_date.hasRelCalendar())
-      start_date.checkDate();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_start_date(context_Ptr context_hdl, cxios_date* start_date_c)
-  {
-    CTimer::get("XIOS").resume();
-    CDate start_date = context_hdl->start_date.getInheritedValue();
-    start_date_c->year = start_date.getYear();
-    start_date_c->month = start_date.getMonth();
-    start_date_c->day = start_date.getDay();
-    start_date_c->hour = start_date.getHour();
-    start_date_c->minute = start_date.getMinute();
-    start_date_c->second = start_date.getSecond();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_start_date(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->start_date.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
-  
-  void cxios_set_context_time_origin(context_Ptr context_hdl, cxios_date time_origin_c)
-  {
-    CTimer::get("XIOS").resume();
-    context_hdl->time_origin.allocate();
-    CDate& time_origin = context_hdl->time_origin.get();
-    time_origin.setDate(time_origin_c.year,
-                           time_origin_c.month,
-                           time_origin_c.day,
-                           time_origin_c.hour,
-                           time_origin_c.minute,
-                           time_origin_c.second);
-    if (time_origin.hasRelCalendar())
-      time_origin.checkDate();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_time_origin(context_Ptr context_hdl, cxios_date* time_origin_c)
-  {
-    CTimer::get("XIOS").resume();
-    CDate time_origin = context_hdl->time_origin.getInheritedValue();
-    time_origin_c->year = time_origin.getYear();
-    time_origin_c->month = time_origin.getMonth();
-    time_origin_c->day = time_origin.getDay();
-    time_origin_c->hour = time_origin.getHour();
-    time_origin_c->minute = time_origin.getMinute();
-    time_origin_c->second = time_origin.getSecond();
-    CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_time_origin(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->time_origin.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
-  
-  void cxios_set_context_timestep(context_Ptr context_hdl, cxios_duration timestep_c)
-  {
-    CTimer::get("XIOS").resume();
-    context_hdl->timestep.allocate();
-    CDuration& timestep = context_hdl->timestep.get();
-    timestep.year = timestep_c.year;
-    timestep.month = timestep_c.month;
-    timestep.day = timestep_c.day;
-    timestep.hour = timestep_c.hour;
-    timestep.minute = timestep_c.minute;
-    timestep.second = timestep_c.second;
-    timestep.timestep = timestep_c.timestep;
-    CTimer::get("XIOS").suspend();
-  }
-  
-  void cxios_get_context_timestep(context_Ptr context_hdl, cxios_duration* timestep_c)
-  {
-    CTimer::get("XIOS").resume();
-    CDuration timestep = context_hdl->timestep.getInheritedValue();
-    timestep_c->year = timestep.year;
-    timestep_c->month = timestep.month;
-    timestep_c->day = timestep.day;
-    timestep_c->hour = timestep.hour;
-    timestep_c->minute = timestep.minute;
-    timestep_c->second = timestep.second;
-    timestep_c->timestep = timestep.timestep;
-    CTimer::get("XIOS").suspend();
-  }
-  
-  bool cxios_is_defined_context_timestep(context_Ptr context_hdl )
-  {
-     CTimer::get("XIOS").resume();
-    return context_hdl->timestep.hasInheritedValue();
-     CTimer::get("XIOS").suspend();
-  }
-  
-  
-  
   
 }
Index: XIOS/trunk/src/interface/fortran/calendar_interface.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/calendar_interface.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran/calendar_interface.F90	(revision 549)
@@ -0,0 +1,29 @@
+#include "xios_fortran_prefix.hpp"
+
+MODULE CALENDAR_INTERFACE
+   USE, INTRINSIC :: ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE cxios_update_calendar(step) BIND(C)
+         IMPORT C_INT
+         INTEGER (kind = C_INT), VALUE :: step
+      END SUBROUTINE cxios_update_calendar
+
+      SUBROUTINE cxios_get_current_date(current_date) BIND(C)
+         USE IDATE
+         TYPE(txios(date))             :: current_date
+      END SUBROUTINE cxios_get_current_date
+
+      INTEGER(kind = C_INT) FUNCTION cxios_get_year_length_in_seconds(year) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER(kind = C_INT), VALUE :: year
+      END FUNCTION cxios_get_year_length_in_seconds
+
+      INTEGER(kind = C_INT) FUNCTION cxios_get_day_length_in_seconds() BIND(C)
+         USE ISO_C_BINDING
+      END FUNCTION cxios_get_day_length_in_seconds
+
+   END INTERFACE
+
+END MODULE CALENDAR_INTERFACE
Index: XIOS/trunk/src/interface/fortran/calendar_interface.f90
===================================================================
--- XIOS/trunk/src/interface/fortran/calendar_interface.f90	(revision 546)
+++ 	(revision )
@@ -1,16 +1,0 @@
-MODULE CALENDAR_INTERFACE
-   USE, INTRINSIC :: ISO_C_BINDING
-     
-   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
-
-      SUBROUTINE cxios_create_calendar() BIND(C)
-      END SUBROUTINE cxios_create_calendar
-
-      SUBROUTINE cxios_update_calendar(step) BIND(C)
-         IMPORT C_INT
-         INTEGER (kind = C_INT), VALUE :: step
-      END SUBROUTINE cxios_update_calendar
-
-   END INTERFACE
-     
-END MODULE CALENDAR_INTERFACE
Index: XIOS/trunk/src/interface/fortran/calendar_wrapper_interface.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/calendar_wrapper_interface.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran/calendar_wrapper_interface.F90	(revision 549)
@@ -0,0 +1,67 @@
+#include "../fortran/xios_fortran_prefix.hpp"
+
+MODULE CALENDAR_WRAPPER_INTERFACE
+   USE, INTRINSIC :: ISO_C_BINDING
+
+   INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
+
+      SUBROUTINE cxios_calendar_wrapper_handle_create(ret, idt, idt_size) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T)               :: ret
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt
+         INTEGER  (kind = C_INT)     , VALUE        :: idt_size
+      END SUBROUTINE cxios_calendar_wrapper_handle_create
+
+      SUBROUTINE cxios_get_current_calendar_wrapper(ret) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T)               :: ret
+      END SUBROUTINE cxios_get_current_calendar_wrapper
+
+      SUBROUTINE cxios_calendar_wrapper_valid_id(ret, idt, idt_size) BIND(C)
+         USE ISO_C_BINDING
+         LOGICAL  (kind = C_BOOL)                   :: ret
+         CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: idt
+         INTEGER  (kind = C_INT)     , VALUE        :: idt_size
+      END SUBROUTINE cxios_calendar_wrapper_valid_id
+
+      SUBROUTINE cxios_create_calendar(hdl) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: hdl
+      END SUBROUTINE cxios_create_calendar
+
+      SUBROUTINE cxios_update_calendar_timestep(hdl) BIND(C)
+         USE ISO_C_BINDING
+         INTEGER  (kind = C_INTPTR_T), VALUE        :: hdl
+      END SUBROUTINE cxios_update_calendar_timestep
+
+      SUBROUTINE cxios_set_calendar_wrapper_date_start_date(hdl, start_date) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date)), VALUE           :: start_date
+      END SUBROUTINE cxios_set_calendar_wrapper_date_start_date
+
+      SUBROUTINE cxios_get_calendar_wrapper_date_start_date(hdl, start_date) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date))                  :: start_date
+      END SUBROUTINE cxios_get_calendar_wrapper_date_start_date
+
+      SUBROUTINE cxios_set_calendar_wrapper_date_time_origin(hdl, time_origin) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date)), VALUE           :: time_origin
+      END SUBROUTINE cxios_set_calendar_wrapper_date_time_origin
+
+      SUBROUTINE cxios_get_calendar_wrapper_date_time_origin(hdl, time_origin) BIND(C)
+         USE ISO_C_BINDING
+         USE IDATE
+         INTEGER (kind = C_INTPTR_T), VALUE :: hdl
+         TYPE(txios(date))                  :: time_origin
+      END SUBROUTINE cxios_get_calendar_wrapper_date_time_origin
+
+   END INTERFACE
+
+END MODULE CALENDAR_WRAPPER_INTERFACE
Index: XIOS/trunk/src/interface/fortran/date_interface.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/date_interface.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/date_interface.F90	(revision 549)
@@ -7,5 +7,5 @@
       INTEGER(kind = C_INT) :: year, month, day, hour, minute, second
    END TYPE txios(date)
-     
+
    INTERFACE ! Ne pas appeler directement/Interface FORTRAN 2003 <-> C99
 
@@ -75,5 +75,35 @@
       END FUNCTION cxios_date_ge
 
+      INTEGER(kind = C_INT) FUNCTION cxios_date_get_second_of_year(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_second_of_year
+
+      REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_day_of_year(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_day_of_year
+
+      REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_fraction_of_year(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_fraction_of_year
+
+      INTEGER(kind = C_INT) FUNCTION cxios_date_get_second_of_day(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_second_of_day
+
+      REAL(kind = C_DOUBLE) FUNCTION cxios_date_get_fraction_of_day(date) BIND(C)
+         USE ISO_C_BINDING
+         IMPORT :: txios(date)
+         TYPE(txios(date)), VALUE :: date
+      END FUNCTION cxios_date_get_fraction_of_day
+
    END INTERFACE
-     
+
 END MODULE DATE_INTERFACE
Index: XIOS/trunk/src/interface/fortran/icalendar.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/icalendar.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/icalendar.F90	(revision 549)
@@ -3,4 +3,5 @@
    USE, INTRINSIC :: ISO_C_BINDING
    USE CALENDAR_INTERFACE
+   USE ICALENDAR_WRAPPER
    USE IDATE
    USE IDURATION
@@ -9,53 +10,165 @@
    INTEGER(kind = C_INT), PARAMETER :: D360 = 0 , ALLLEAP = 1 , NOLEAP = 2 , JULIAN = 3 , GREGORIAN = 4
 
+   INTERFACE xios(set_start_date)
+      MODULE PROCEDURE xios(set_start_date_date), xios(set_start_date_dur)
+   END INTERFACE xios(set_start_date)
+
+   INTERFACE xios(set_time_origin)
+      MODULE PROCEDURE xios(set_time_origin_date), xios(set_time_origin_dur)
+   END INTERFACE xios(set_time_origin)
+
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
 
-   SUBROUTINE xios(set_calendar)(calendar_type, start_date, time_origin, timestep)
-      USE ICONTEXT, ONLY : txios(context), xios(get_current_context)
-      USE icontext_attr, ONLY : xios(set_context_attr_hdl)
-      USE IDATE, ONLY : txios(date)
-      USE IDURATION, ONLY : txios(duration)
-      IMPLICIT NONE
-      CHARACTER(len = *),    OPTIONAL, INTENT(IN) :: calendar_type
+   SUBROUTINE xios(define_calendar)(type, timestep, start_date, time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl)
+      USE IDURATION, ONLY : txios(duration)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      CHARACTER(len = *),              INTENT(IN) :: type
+      TYPE(txios(duration)), OPTIONAL, INTENT(IN) :: timestep
       TYPE(txios(date)),     OPTIONAL, INTENT(IN) :: start_date
       TYPE(txios(date)),     OPTIONAL, INTENT(IN) :: time_origin
-      TYPE(txios(duration)), OPTIONAL, INTENT(IN) :: timestep
-      TYPE(txios(context)) :: context
-
-      CALL xios(get_current_context)(context)
-
-      IF (PRESENT(calendar_type)) THEN
-         CALL xios(set_context_attr_hdl)(context, calendar_type=calendar_type)
-      END IF
+      TYPE(txios(calendar_wrapper)) :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, type=type)
+      IF (PRESENT(timestep)) THEN
+         CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep)
+      END IF
+
+      CALL xios(create_calendar)(calendar_wrapper)
+
       IF (PRESENT(start_date)) THEN
-         CALL xios(set_context_attr_hdl)(context, start_date=start_date)
+         CALL xios(set_start_date_hdl)(calendar_wrapper, start_date=start_date)
       END IF
       IF (PRESENT(time_origin)) THEN
-         CALL xios(set_context_attr_hdl)(context, time_origin=time_origin)
-      END IF
-      IF (PRESENT(time_origin)) THEN
-         CALL xios(set_context_attr_hdl)(context, timestep=timestep)
-      END IF
-
-      CALL cxios_create_calendar()
-   END SUBROUTINE xios(set_calendar)
+         CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin=time_origin)
+      END IF
+   END SUBROUTINE xios(define_calendar)
+
+   SUBROUTINE xios(get_calendar_type)(calendar_type)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(get_calendar_wrapper_attr_hdl)
+      IMPLICIT NONE
+      CHARACTER(len = *), INTENT(OUT) :: calendar_type
+      TYPE(txios(calendar_wrapper))   :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_calendar_wrapper_attr_hdl)(calendar_wrapper, type=calendar_type)
+   END SUBROUTINE xios(get_calendar_type)
 
    SUBROUTINE xios(set_timestep)(timestep)
-      USE ICONTEXT, ONLY : txios(context), xios(get_current_context)
-      USE icontext_attr, ONLY : xios(set_context_attr_hdl)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(set_calendar_wrapper_attr_hdl)
       USE IDURATION, ONLY : txios(duration)
       IMPLICIT NONE
       TYPE(txios(duration)), INTENT(IN) :: timestep
-      TYPE(txios(context)) :: context
-
-      CALL xios(get_current_context)(context)
-
-      CALL xios(set_context_attr_hdl)(context, timestep=timestep)
+      TYPE(txios(calendar_wrapper))     :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep)
+
+      CALL xios(update_calendar_timestep)(calendar_wrapper)
    END SUBROUTINE xios(set_timestep)
 
+   SUBROUTINE xios(get_timestep)(timestep)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE icalendar_wrapper_attr, ONLY : xios(get_calendar_wrapper_attr_hdl)
+      USE IDURATION, ONLY : txios(duration)
+      IMPLICIT NONE
+      TYPE(txios(duration)), INTENT(OUT) :: timestep
+      TYPE(txios(calendar_wrapper))      :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_calendar_wrapper_attr_hdl)(calendar_wrapper, timestep=timestep)
+   END SUBROUTINE xios(get_timestep)
+
+   SUBROUTINE xios(set_start_date_date)(start_date)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(IN) :: start_date
+      TYPE(txios(calendar_wrapper)) :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_start_date_hdl)(calendar_wrapper, start_date)
+   END SUBROUTINE xios(set_start_date_date)
+
+   SUBROUTINE xios(set_start_date_dur)(start_date)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDURATION, ONLY : txios(duration)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(duration)), INTENT(IN) :: start_date
+      TYPE(txios(calendar_wrapper))     :: calendar_wrapper
+      TYPE(txios(date))                 :: start_date_date
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      start_date_date = start_date
+      CALL xios(set_start_date_hdl)(calendar_wrapper, start_date_date)
+   END SUBROUTINE xios(set_start_date_dur)
+
+   SUBROUTINE xios(get_start_date)(start_date)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: start_date
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_start_date_hdl)(calendar_wrapper, start_date)
+   END SUBROUTINE xios(get_start_date)
+
+   SUBROUTINE xios(set_time_origin_date)(time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(IN) :: time_origin
+      TYPE(txios(calendar_wrapper)) :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin)
+   END SUBROUTINE xios(set_time_origin_date)
+
+   SUBROUTINE xios(set_time_origin_dur)(time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDURATION, ONLY : txios(duration)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(duration)), INTENT(IN) :: time_origin
+      TYPE(txios(calendar_wrapper))     :: calendar_wrapper
+      TYPE(txios(date))                 :: time_origin_date
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      time_origin_date = time_origin
+      CALL xios(set_time_origin_hdl)(calendar_wrapper, time_origin_date)
+   END SUBROUTINE xios(set_time_origin_dur)
+
+   SUBROUTINE xios(get_time_origin)(time_origin)
+      USE ICALENDAR_WRAPPER, ONLY : txios(calendar_wrapper), xios(get_default_calendar_wrapper_handle)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: time_origin
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper
+
+      CALL xios(get_default_calendar_wrapper_handle)(calendar_wrapper)
+
+      CALL xios(get_time_origin_hdl)(calendar_wrapper, time_origin)
+   END SUBROUTINE xios(get_time_origin)
+
    SUBROUTINE xios(update_calendar)(step)
       IMPLICIT NONE
       INTEGER, INTENT(IN) :: step
-      
+
       IF (step < 0) THEN
          PRINT *, "L'argument 'step' ne peut Ãªtre nÃ©gatif"
@@ -65,3 +178,26 @@
    END SUBROUTINE xios(update_calendar)
 
+   SUBROUTINE xios(get_current_date)(current_date)
+      USE IDATE, ONLY : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: current_date
+
+      CALL cxios_get_current_date(current_date)
+   END SUBROUTINE xios(get_current_date)
+
+   FUNCTION xios(get_year_length_in_seconds)(year) RESULT(res)
+      IMPLICIT NONE
+      INTEGER(kind = C_INT), INTENT(IN) :: year
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_get_year_length_in_seconds(year)
+   END FUNCTION xios(get_year_length_in_seconds)
+
+   FUNCTION xios(get_day_length_in_seconds)() RESULT(res)
+      IMPLICIT NONE
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_get_day_length_in_seconds()
+   END FUNCTION xios(get_day_length_in_seconds)
+
 END MODULE ICALENDAR
Index: XIOS/trunk/src/interface/fortran/icalendar_wrapper.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/icalendar_wrapper.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran/icalendar_wrapper.F90	(revision 549)
@@ -0,0 +1,89 @@
+#include "xios_fortran_prefix.hpp"
+
+MODULE ICALENDAR_WRAPPER
+   USE, INTRINSIC :: ISO_C_BINDING
+   USE CALENDAR_WRAPPER_INTERFACE
+   USE IDATE
+   USE IDURATION
+
+   TYPE txios(calendar_wrapper)
+      INTEGER(kind = C_INTPTR_T) :: daddr
+   END TYPE txios(calendar_wrapper)
+
+   CONTAINS ! Fonctions disponibles pour les utilisateurs.
+
+   SUBROUTINE xios(get_calendar_wrapper_handle)(idt, ret)
+      IMPLICIT NONE
+      CHARACTER(len = *),            INTENT(IN)  :: idt
+      TYPE(txios(calendar_wrapper)), INTENT(OUT) :: ret
+
+      CALL cxios_calendar_wrapper_handle_create(ret%daddr, idt, len(idt))
+   END SUBROUTINE xios(get_calendar_wrapper_handle)
+
+   SUBROUTINE xios(get_default_calendar_wrapper_handle)(ret)
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(OUT) :: ret
+
+      CALL cxios_get_current_calendar_wrapper(ret%daddr)
+   END SUBROUTINE xios(get_default_calendar_wrapper_handle)
+
+   LOGICAL FUNCTION xios(is_valid_calendar_wrapper)(idt)
+      IMPLICIT NONE
+      CHARACTER(len  = *), INTENT(IN) :: idt
+      LOGICAL  (kind = 1)             :: val
+
+      CALL cxios_calendar_wrapper_valid_id(val, idt, len(idt));
+      xios(is_valid_calendar_wrapper) = val
+   END FUNCTION  xios(is_valid_calendar_wrapper)
+
+   SUBROUTINE xios(create_calendar)(hdl)
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+
+      CALL cxios_create_calendar(hdl%daddr)
+   END SUBROUTINE xios(create_calendar)
+
+   SUBROUTINE xios(update_calendar_timestep)(hdl)
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+
+      CALL cxios_update_calendar_timestep(hdl%daddr)
+   END SUBROUTINE xios(update_calendar_timestep)
+
+   SUBROUTINE xios(set_start_date_hdl)(hdl, start_date)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+      TYPE(txios(date)),             INTENT(IN) :: start_date
+
+      CALL cxios_set_calendar_wrapper_date_start_date(hdl%daddr, start_date)
+   END SUBROUTINE xios(set_start_date_hdl)
+
+   SUBROUTINE xios(get_start_date_hdl)(hdl, start_date)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN)  :: hdl
+      TYPE(txios(date)),             INTENT(OUT) :: start_date
+
+      CALL cxios_get_calendar_wrapper_date_start_date(hdl%daddr, start_date)
+   END SUBROUTINE xios(get_start_date_hdl)
+
+   SUBROUTINE xios(set_time_origin_hdl)(hdl, time_origin)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN) :: hdl
+      TYPE(txios(date)),             INTENT(IN) :: time_origin
+
+      CALL cxios_set_calendar_wrapper_date_time_origin(hdl%daddr, time_origin)
+   END SUBROUTINE xios(set_time_origin_hdl)
+
+   SUBROUTINE xios(get_time_origin_hdl)(hdl, time_origin)
+      USE IDATE
+      IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)), INTENT(IN)  :: hdl
+      TYPE(txios(date)),             INTENT(OUT) :: time_origin
+
+      CALL cxios_get_calendar_wrapper_date_time_origin(hdl%daddr, time_origin)
+   END SUBROUTINE xios(get_time_origin_hdl)
+
+END MODULE ICALENDAR_WRAPPER
Index: XIOS/trunk/src/interface/fortran/idate.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/idate.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/idate.F90	(revision 549)
@@ -37,4 +37,8 @@
    END INTERFACE
 
+   INTERFACE ASSIGNMENT(=)
+      MODULE PROCEDURE xios(date_assign_duration)
+   END INTERFACE
+
    CONTAINS ! Fonctions disponibles pour les utilisateurs.
 
@@ -140,3 +144,58 @@
    END FUNCTION xios(date_ge)
 
+   SUBROUTINE xios(date_assign_duration)(date, dur)
+      USE DATE_INTERFACE, only : txios(date)
+      USE IDURATION, only : txios(duration)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      TYPE(txios(duration)), INTENT(IN) :: dur
+
+      date = txios(date)(0, 1, 1, 0, 0, 0) + dur
+   END SUBROUTINE xios(date_assign_duration)
+
+   FUNCTION xios(date_get_second_of_year)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_date_get_second_of_year(date)
+   END FUNCTION xios(date_get_second_of_year)
+
+   FUNCTION xios(date_get_day_of_year)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      REAL(kind = C_DOUBLE) :: res
+
+      res = cxios_date_get_day_of_year(date)
+   END FUNCTION xios(date_get_day_of_year)
+
+   FUNCTION xios(date_get_fraction_of_year)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      REAL(kind = C_DOUBLE) :: res
+
+      res = cxios_date_get_fraction_of_year(date)
+   END FUNCTION xios(date_get_fraction_of_year)
+
+   FUNCTION xios(date_get_second_of_day)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      INTEGER(kind = C_INT) :: res
+
+      res = cxios_date_get_second_of_day(date)
+   END FUNCTION xios(date_get_second_of_day)
+
+   FUNCTION xios(date_get_fraction_of_day)(date) RESULT(res)
+      USE DATE_INTERFACE, only : txios(date)
+      IMPLICIT NONE
+      TYPE(txios(date)), INTENT(OUT) :: date
+      REAL(kind = C_DOUBLE) :: res
+
+      res = cxios_date_get_fraction_of_day(date)
+   END FUNCTION xios(date_get_fraction_of_day)
+
 END MODULE IDATE
Index: XIOS/trunk/src/interface/fortran/ixios.F90
===================================================================
--- XIOS/trunk/src/interface/fortran/ixios.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran/ixios.F90	(revision 549)
@@ -3,5 +3,8 @@
 MODULE XIOS
 
-USE icalendar, ONLY : xios(set_calendar), xios(set_timestep), xios(update_calendar)
+USE icalendar, ONLY : xios(define_calendar), xios(set_timestep), xios(set_start_date), xios(set_time_origin), &
+                      xios(get_calendar_type), xios(get_timestep), xios(get_start_date), xios(get_time_origin), &
+                      xios(update_calendar), xios(get_current_date), &
+                      xios(get_year_length_in_seconds), xios(get_day_length_in_seconds)
 
 USE icontext, ONLY : txios(context), xios(get_context_handle), xios(set_current_context),    &
@@ -24,6 +27,9 @@
                   xios(date_add_duration), xios(date_sub_duration), xios(date_sub), &
                   xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), &
+                  xios(date_get_second_of_year), xios(date_get_day_of_year), xios(date_get_fraction_of_year), &
+                  xios(date_get_second_of_day), xios(date_get_fraction_of_day), &
                   OPERATOR(+), OPERATOR(-), &
-                  OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=)
+                  OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=), &
+                  ASSIGNMENT(=)
 
 USE idomain, ONLY : txios(domain), txios(domaingroup), xios(get_domain_handle),  &
@@ -200,5 +206,8 @@
            xios(field_is_active)
 
- PUBLIC :: xios(set_calendar), xios(set_timestep), xios(update_calendar)
+ PUBLIC :: xios(define_calendar), xios(set_timestep), xios(set_start_date), xios(set_time_origin), &
+           xios(get_calendar_type), xios(get_timestep), xios(get_start_date), xios(get_time_origin), &
+           xios(update_calendar), xios(get_current_date), &
+           xios(get_year_length_in_seconds), xios(get_day_length_in_seconds)
 
  PUBLIC :: xios(year), xios(month), xios(day), xios(hour), xios(minute), xios(second), xios(timestep), &
@@ -208,8 +217,11 @@
  PUBLIC :: xios(date_convert_to_seconds), &
            xios(date_add_duration), xios(date_sub_duration), xios(date_sub), &
-           xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge)
+           xios(date_eq), xios(date_neq), xios(date_lt), xios(date_le), xios(date_gt), xios(date_ge), &
+           xios(date_get_second_of_year), xios(date_get_day_of_year), xios(date_get_fraction_of_year), &
+           xios(date_get_second_of_day), xios(date_get_fraction_of_day)
 
  PUBLIC :: OPERATOR(+), OPERATOR(-), OPERATOR(*), &
-           OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=)
+           OPERATOR(==), OPERATOR(/=), OPERATOR(<), OPERATOR(<=), OPERATOR(>), OPERATOR(>=), &
+           ASSIGNMENT(=)
 
  PUBLIC :: xios(getVar)
Index: XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran_attr/calendar_wrapper_interface_attr.F90	(revision 549)
@@ -0,0 +1,98 @@
+! * ************************************************************************** *
+! *               Interface auto generated - do not modify                     *
+! * ************************************************************************** *
+#include "../fortran/xios_fortran_prefix.hpp"
+
+MODULE calendar_wrapper_interface_attr
+  USE, INTRINSIC :: ISO_C_BINDING
+  
+  INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_start_date(calendar_wrapper_hdl, start_date, start_date_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: start_date
+      INTEGER  (kind = C_INT)     , VALUE        :: start_date_size
+    END SUBROUTINE cxios_set_calendar_wrapper_start_date
+    
+    SUBROUTINE cxios_get_calendar_wrapper_start_date(calendar_wrapper_hdl, start_date, start_date_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: start_date
+      INTEGER  (kind = C_INT)     , VALUE        :: start_date_size
+    END SUBROUTINE cxios_get_calendar_wrapper_start_date
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_start_date
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_start_date
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_time_origin(calendar_wrapper_hdl, time_origin, time_origin_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: time_origin
+      INTEGER  (kind = C_INT)     , VALUE        :: time_origin_size
+    END SUBROUTINE cxios_set_calendar_wrapper_time_origin
+    
+    SUBROUTINE cxios_get_calendar_wrapper_time_origin(calendar_wrapper_hdl, time_origin, time_origin_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: time_origin
+      INTEGER  (kind = C_INT)     , VALUE        :: time_origin_size
+    END SUBROUTINE cxios_get_calendar_wrapper_time_origin
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_time_origin
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_time_origin
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_timestep(calendar_wrapper_hdl, timestep) BIND(C)
+      USE ISO_C_BINDING
+      USE IDURATION
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      TYPE(txios(duration)), VALUE :: timestep
+    END SUBROUTINE cxios_set_calendar_wrapper_timestep
+    
+    SUBROUTINE cxios_get_calendar_wrapper_timestep(calendar_wrapper_hdl, timestep) BIND(C)
+      USE ISO_C_BINDING
+      USE IDURATION
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      TYPE(txios(duration)) :: timestep
+    END SUBROUTINE cxios_get_calendar_wrapper_timestep
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_timestep
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_timestep
+    
+    
+    SUBROUTINE cxios_set_calendar_wrapper_type(calendar_wrapper_hdl, type, type_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type
+      INTEGER  (kind = C_INT)     , VALUE        :: type_size
+    END SUBROUTINE cxios_set_calendar_wrapper_type
+    
+    SUBROUTINE cxios_get_calendar_wrapper_type(calendar_wrapper_hdl, type, type_size) BIND(C)
+      USE ISO_C_BINDING
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: type
+      INTEGER  (kind = C_INT)     , VALUE        :: type_size
+    END SUBROUTINE cxios_get_calendar_wrapper_type
+    
+    FUNCTION cxios_is_defined_calendar_wrapper_type(calendar_wrapper_hdl ) BIND(C)
+      USE ISO_C_BINDING
+      LOGICAL(kind=C_BOOL) :: cxios_is_defined_calendar_wrapper_type
+      INTEGER (kind = C_INTPTR_T), VALUE :: calendar_wrapper_hdl
+    END FUNCTION cxios_is_defined_calendar_wrapper_type
+    
+    
+    END INTERFACE
+  
+END MODULE calendar_wrapper_interface_attr
Index: XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran_attr/context_interface_attr.F90	(revision 549)
@@ -8,25 +8,4 @@
   
   INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99
-    
-    
-    SUBROUTINE cxios_set_context_calendar_type(context_hdl, calendar_type, calendar_type_size) BIND(C)
-      USE ISO_C_BINDING
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: calendar_type
-      INTEGER  (kind = C_INT)     , VALUE        :: calendar_type_size
-    END SUBROUTINE cxios_set_context_calendar_type
-    
-    SUBROUTINE cxios_get_context_calendar_type(context_hdl, calendar_type, calendar_type_size) BIND(C)
-      USE ISO_C_BINDING
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      CHARACTER(kind = C_CHAR)    , DIMENSION(*) :: calendar_type
-      INTEGER  (kind = C_INT)     , VALUE        :: calendar_type_size
-    END SUBROUTINE cxios_get_context_calendar_type
-    
-    FUNCTION cxios_is_defined_context_calendar_type(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_calendar_type
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_calendar_type
     
     
@@ -52,67 +31,4 @@
     
     
-    SUBROUTINE cxios_set_context_start_date(context_hdl, start_date) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)), VALUE :: start_date
-    END SUBROUTINE cxios_set_context_start_date
-    
-    SUBROUTINE cxios_get_context_start_date(context_hdl, start_date) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)) :: start_date
-    END SUBROUTINE cxios_get_context_start_date
-    
-    FUNCTION cxios_is_defined_context_start_date(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_start_date
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_start_date
-    
-    
-    SUBROUTINE cxios_set_context_time_origin(context_hdl, time_origin) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)), VALUE :: time_origin
-    END SUBROUTINE cxios_set_context_time_origin
-    
-    SUBROUTINE cxios_get_context_time_origin(context_hdl, time_origin) BIND(C)
-      USE ISO_C_BINDING
-      USE IDATE
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(date)) :: time_origin
-    END SUBROUTINE cxios_get_context_time_origin
-    
-    FUNCTION cxios_is_defined_context_time_origin(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_time_origin
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_time_origin
-    
-    
-    SUBROUTINE cxios_set_context_timestep(context_hdl, timestep) BIND(C)
-      USE ISO_C_BINDING
-      USE IDURATION
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(duration)), VALUE :: timestep
-    END SUBROUTINE cxios_set_context_timestep
-    
-    SUBROUTINE cxios_get_context_timestep(context_hdl, timestep) BIND(C)
-      USE ISO_C_BINDING
-      USE IDURATION
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-      TYPE(txios(duration)) :: timestep
-    END SUBROUTINE cxios_get_context_timestep
-    
-    FUNCTION cxios_is_defined_context_timestep(context_hdl ) BIND(C)
-      USE ISO_C_BINDING
-      LOGICAL(kind=C_BOOL) :: cxios_is_defined_context_timestep
-      INTEGER (kind = C_INTPTR_T), VALUE :: context_hdl
-    END FUNCTION cxios_is_defined_context_timestep
-    
-    
     END INTERFACE
   
Index: XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90	(revision 549)
+++ XIOS/trunk/src/interface/fortran_attr/icalendar_wrapper_attr.F90	(revision 549)
@@ -0,0 +1,215 @@
+! * ************************************************************************** *
+! *               Interface auto generated - do not modify                     *
+! * ************************************************************************** *
+#include "xios_fortran_prefix.hpp"
+
+MODULE icalendar_wrapper_attr
+  USE, INTRINSIC :: ISO_C_BINDING
+  USE icalendar_wrapper
+  USE calendar_wrapper_interface_attr
+  
+CONTAINS
+  
+  SUBROUTINE xios(set_calendar_wrapper_attr)  &
+    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
+      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
+      
+      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
+      CALL xios(set_calendar_wrapper_attr_hdl_)   &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(set_calendar_wrapper_attr)
+  
+  SUBROUTINE xios(set_calendar_wrapper_attr_hdl)  &
+    ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type
+      
+      CALL xios(set_calendar_wrapper_attr_hdl_)  &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl)
+  
+  SUBROUTINE xios(set_calendar_wrapper_attr_hdl_)   &
+    ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: start_date_
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: time_origin_
+      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep_
+      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: type_
+      
+      IF (PRESENT(start_date_)) THEN
+        CALL cxios_set_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr, start_date_, len(start_date_))
+      ENDIF
+      
+      IF (PRESENT(time_origin_)) THEN
+        CALL cxios_set_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_))
+      ENDIF
+      
+      IF (PRESENT(timestep_)) THEN
+        CALL cxios_set_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr, timestep_)
+      ENDIF
+      
+      IF (PRESENT(type_)) THEN
+        CALL cxios_set_calendar_wrapper_type(calendar_wrapper_hdl%daddr, type_, len(type_))
+      ENDIF
+      
+      
+    
+  END SUBROUTINE xios(set_calendar_wrapper_attr_hdl_)
+  
+  SUBROUTINE xios(get_calendar_wrapper_attr)  &
+    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
+      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
+      
+      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
+      CALL xios(get_calendar_wrapper_attr_hdl_)   &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(get_calendar_wrapper_attr)
+  
+  SUBROUTINE xios(get_calendar_wrapper_attr_hdl)  &
+    ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin
+      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type
+      
+      CALL xios(get_calendar_wrapper_attr_hdl_)  &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl)
+  
+  SUBROUTINE xios(get_calendar_wrapper_attr_hdl_)   &
+    ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: start_date_
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: time_origin_
+      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep_
+      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: type_
+      
+      IF (PRESENT(start_date_)) THEN
+        CALL cxios_get_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr, start_date_, len(start_date_))
+      ENDIF
+      
+      IF (PRESENT(time_origin_)) THEN
+        CALL cxios_get_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr, time_origin_, len(time_origin_))
+      ENDIF
+      
+      IF (PRESENT(timestep_)) THEN
+        CALL cxios_get_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr, timestep_)
+      ENDIF
+      
+      IF (PRESENT(type_)) THEN
+        CALL cxios_get_calendar_wrapper_type(calendar_wrapper_hdl%daddr, type_, len(type_))
+      ENDIF
+      
+      
+    
+  END SUBROUTINE xios(get_calendar_wrapper_attr_hdl_)
+  
+  SUBROUTINE xios(is_defined_calendar_wrapper_attr)  &
+    ( calendar_wrapper_id, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper))  :: calendar_wrapper_hdl
+      CHARACTER(LEN=*), INTENT(IN) ::calendar_wrapper_id
+      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
+      LOGICAL(KIND=C_BOOL) :: start_date_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
+      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
+      LOGICAL(KIND=C_BOOL) :: timestep_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: type
+      LOGICAL(KIND=C_BOOL) :: type_tmp
+      
+      CALL xios(get_calendar_wrapper_handle)(calendar_wrapper_id,calendar_wrapper_hdl)
+      CALL xios(is_defined_calendar_wrapper_attr_hdl_)   &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(is_defined_calendar_wrapper_attr)
+  
+  SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl)  &
+    ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
+      LOGICAL(KIND=C_BOOL) :: start_date_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
+      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
+      LOGICAL(KIND=C_BOOL) :: timestep_tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: type
+      LOGICAL(KIND=C_BOOL) :: type_tmp
+      
+      CALL xios(is_defined_calendar_wrapper_attr_hdl_)  &
+      ( calendar_wrapper_hdl, start_date, time_origin, timestep, type )
+    
+  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl)
+  
+  SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_)   &
+    ( calendar_wrapper_hdl, start_date_, time_origin_, timestep_, type_ )
+    
+    IMPLICIT NONE
+      TYPE(txios(calendar_wrapper)) , INTENT(IN) :: calendar_wrapper_hdl
+      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_
+      LOGICAL(KIND=C_BOOL) :: start_date__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin_
+      LOGICAL(KIND=C_BOOL) :: time_origin__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep_
+      LOGICAL(KIND=C_BOOL) :: timestep__tmp
+      LOGICAL, OPTIONAL, INTENT(OUT) :: type_
+      LOGICAL(KIND=C_BOOL) :: type__tmp
+      
+      IF (PRESENT(start_date_)) THEN
+        start_date__tmp=cxios_is_defined_calendar_wrapper_start_date(calendar_wrapper_hdl%daddr)
+        start_date_=start_date__tmp
+      ENDIF
+      
+      IF (PRESENT(time_origin_)) THEN
+        time_origin__tmp=cxios_is_defined_calendar_wrapper_time_origin(calendar_wrapper_hdl%daddr)
+        time_origin_=time_origin__tmp
+      ENDIF
+      
+      IF (PRESENT(timestep_)) THEN
+        timestep__tmp=cxios_is_defined_calendar_wrapper_timestep(calendar_wrapper_hdl%daddr)
+        timestep_=timestep__tmp
+      ENDIF
+      
+      IF (PRESENT(type_)) THEN
+        type__tmp=cxios_is_defined_calendar_wrapper_type(calendar_wrapper_hdl%daddr)
+        type_=type__tmp
+      ENDIF
+      
+      
+    
+  END SUBROUTINE xios(is_defined_calendar_wrapper_attr_hdl_)
+  
+END MODULE icalendar_wrapper_attr
Index: XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90
===================================================================
--- XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90	(revision 546)
+++ XIOS/trunk/src/interface/fortran_attr/icontext_attr.F90	(revision 549)
@@ -12,66 +12,38 @@
   
   SUBROUTINE xios(set_context_attr)  &
-    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_id, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context))  :: context_hdl
       CHARACTER(LEN=*), INTENT(IN) ::context_id
-      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
       
       CALL xios(get_context_handle)(context_id,context_hdl)
       CALL xios(set_context_attr_hdl_)   &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(set_context_attr)
   
   SUBROUTINE xios(set_context_attr_hdl)  &
-    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_hdl, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep
       
       CALL xios(set_context_attr_hdl_)  &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(set_context_attr_hdl)
   
   SUBROUTINE xios(set_context_attr_hdl_)   &
-    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ )
+    ( context_hdl, output_dir_ )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: calendar_type_
       CHARACTER(len = *) , OPTIONAL, INTENT(IN) :: output_dir_
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: start_date_
-      TYPE(txios(date))  , OPTIONAL, INTENT(IN) :: time_origin_
-      TYPE(txios(duration))  , OPTIONAL, INTENT(IN) :: timestep_
-      
-      IF (PRESENT(calendar_type_)) THEN
-        CALL cxios_set_context_calendar_type(context_hdl%daddr, calendar_type_, len(calendar_type_))
-      ENDIF
       
       IF (PRESENT(output_dir_)) THEN
         CALL cxios_set_context_output_dir(context_hdl%daddr, output_dir_, len(output_dir_))
-      ENDIF
-      
-      IF (PRESENT(start_date_)) THEN
-        CALL cxios_set_context_start_date(context_hdl%daddr, start_date_)
-      ENDIF
-      
-      IF (PRESENT(time_origin_)) THEN
-        CALL cxios_set_context_time_origin(context_hdl%daddr, time_origin_)
-      ENDIF
-      
-      IF (PRESENT(timestep_)) THEN
-        CALL cxios_set_context_timestep(context_hdl%daddr, timestep_)
       ENDIF
       
@@ -81,66 +53,38 @@
   
   SUBROUTINE xios(get_context_attr)  &
-    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_id, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context))  :: context_hdl
       CHARACTER(LEN=*), INTENT(IN) ::context_id
-      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
       
       CALL xios(get_context_handle)(context_id,context_hdl)
       CALL xios(get_context_attr_hdl_)   &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(get_context_attr)
   
   SUBROUTINE xios(get_context_attr_hdl)  &
-    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_hdl, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: calendar_type
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin
-      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep
       
       CALL xios(get_context_attr_hdl_)  &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(get_context_attr_hdl)
   
   SUBROUTINE xios(get_context_attr_hdl_)   &
-    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ )
+    ( context_hdl, output_dir_ )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: calendar_type_
       CHARACTER(len = *) , OPTIONAL, INTENT(OUT) :: output_dir_
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: start_date_
-      TYPE(txios(date))  , OPTIONAL, INTENT(OUT) :: time_origin_
-      TYPE(txios(duration))  , OPTIONAL, INTENT(OUT) :: timestep_
-      
-      IF (PRESENT(calendar_type_)) THEN
-        CALL cxios_get_context_calendar_type(context_hdl%daddr, calendar_type_, len(calendar_type_))
-      ENDIF
       
       IF (PRESENT(output_dir_)) THEN
         CALL cxios_get_context_output_dir(context_hdl%daddr, output_dir_, len(output_dir_))
-      ENDIF
-      
-      IF (PRESENT(start_date_)) THEN
-        CALL cxios_get_context_start_date(context_hdl%daddr, start_date_)
-      ENDIF
-      
-      IF (PRESENT(time_origin_)) THEN
-        CALL cxios_get_context_time_origin(context_hdl%daddr, time_origin_)
-      ENDIF
-      
-      IF (PRESENT(timestep_)) THEN
-        CALL cxios_get_context_timestep(context_hdl%daddr, timestep_)
       ENDIF
       
@@ -150,86 +94,42 @@
   
   SUBROUTINE xios(is_defined_context_attr)  &
-    ( context_id, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_id, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context))  :: context_hdl
       CHARACTER(LEN=*), INTENT(IN) ::context_id
-      LOGICAL, OPTIONAL, INTENT(OUT) :: calendar_type
-      LOGICAL(KIND=C_BOOL) :: calendar_type_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir
       LOGICAL(KIND=C_BOOL) :: output_dir_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
-      LOGICAL(KIND=C_BOOL) :: start_date_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
-      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
-      LOGICAL(KIND=C_BOOL) :: timestep_tmp
       
       CALL xios(get_context_handle)(context_id,context_hdl)
       CALL xios(is_defined_context_attr_hdl_)   &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(is_defined_context_attr)
   
   SUBROUTINE xios(is_defined_context_attr_hdl)  &
-    ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+    ( context_hdl, output_dir )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      LOGICAL, OPTIONAL, INTENT(OUT) :: calendar_type
-      LOGICAL(KIND=C_BOOL) :: calendar_type_tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir
       LOGICAL(KIND=C_BOOL) :: output_dir_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date
-      LOGICAL(KIND=C_BOOL) :: start_date_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin
-      LOGICAL(KIND=C_BOOL) :: time_origin_tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep
-      LOGICAL(KIND=C_BOOL) :: timestep_tmp
       
       CALL xios(is_defined_context_attr_hdl_)  &
-      ( context_hdl, calendar_type, output_dir, start_date, time_origin, timestep )
+      ( context_hdl, output_dir )
     
   END SUBROUTINE xios(is_defined_context_attr_hdl)
   
   SUBROUTINE xios(is_defined_context_attr_hdl_)   &
-    ( context_hdl, calendar_type_, output_dir_, start_date_, time_origin_, timestep_ )
+    ( context_hdl, output_dir_ )
     
     IMPLICIT NONE
       TYPE(txios(context)) , INTENT(IN) :: context_hdl
-      LOGICAL, OPTIONAL, INTENT(OUT) :: calendar_type_
-      LOGICAL(KIND=C_BOOL) :: calendar_type__tmp
       LOGICAL, OPTIONAL, INTENT(OUT) :: output_dir_
       LOGICAL(KIND=C_BOOL) :: output_dir__tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: start_date_
-      LOGICAL(KIND=C_BOOL) :: start_date__tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: time_origin_
-      LOGICAL(KIND=C_BOOL) :: time_origin__tmp
-      LOGICAL, OPTIONAL, INTENT(OUT) :: timestep_
-      LOGICAL(KIND=C_BOOL) :: timestep__tmp
-      
-      IF (PRESENT(calendar_type_)) THEN
-        calendar_type__tmp=cxios_is_defined_context_calendar_type(context_hdl%daddr)
-        calendar_type_=calendar_type__tmp
-      ENDIF
       
       IF (PRESENT(output_dir_)) THEN
         output_dir__tmp=cxios_is_defined_context_output_dir(context_hdl%daddr)
         output_dir_=output_dir__tmp
-      ENDIF
-      
-      IF (PRESENT(start_date_)) THEN
-        start_date__tmp=cxios_is_defined_context_start_date(context_hdl%daddr)
-        start_date_=start_date__tmp
-      ENDIF
-      
-      IF (PRESENT(time_origin_)) THEN
-        time_origin__tmp=cxios_is_defined_context_time_origin(context_hdl%daddr)
-        time_origin_=time_origin__tmp
-      ENDIF
-      
-      IF (PRESENT(timestep_)) THEN
-        timestep__tmp=cxios_is_defined_context_timestep(context_hdl%daddr)
-        timestep_=timestep__tmp
       ENDIF
       
Index: XIOS/trunk/src/node/calendar_wrapper.cpp
===================================================================
--- XIOS/trunk/src/node/calendar_wrapper.cpp	(revision 549)
+++ XIOS/trunk/src/node/calendar_wrapper.cpp	(revision 549)
@@ -0,0 +1,141 @@
+#include "calendar_wrapper.hpp"
+#include "type.hpp"
+#include "calendar_type.hpp"
+#include "duration.hpp"
+#include "context.hpp"
+
+namespace xios {
+
+  /// ////////////////////// DÃ©finitions ////////////////////// ///
+
+  CCalendarWrapper::CCalendarWrapper(void)
+    : CObjectTemplate<CCalendarWrapper>(), CCalendarWrapperAttributes()
+  { /* Ne rien faire de plus */ }
+
+  CCalendarWrapper::CCalendarWrapper(const StdString & id)
+    : CObjectTemplate<CCalendarWrapper>(id), CCalendarWrapperAttributes()
+  { /* Ne rien faire de plus */ }
+
+  CCalendarWrapper::~CCalendarWrapper(void)
+  {}
+
+  //----------------------------------------------------------------
+
+  StdString CCalendarWrapper::GetName(void)    { return StdString("calendar_wrapper"); }
+  StdString CCalendarWrapper::GetDefName(void) { return StdString("calendar"); }
+  ENodeType CCalendarWrapper::GetType(void)    { return eCalendarWrapper; }
+
+  //----------------------------------------------------------------
+
+  /*!
+  \brief Extract the calendar from its wrapper
+  \return the calendar
+  */
+  boost::shared_ptr<CCalendar> CCalendarWrapper::getCalendar(bool checkValid /*= false*/) const
+  {
+    if (checkValid && !this->calendar)
+      ERROR("CCalendarWrapper::getCalendar(bool checkValid = true)", << "The calendar was accessed before being created!");
+    return this->calendar;
+  }
+
+  const CDate& CCalendarWrapper::getInitDate() const
+  {
+    return getCalendar(true)->getInitDate();
+  }
+
+  const CDate& CCalendarWrapper::getTimeOrigin() const
+  {
+    return getCalendar(true)->getTimeOrigin();
+  }
+
+  //----------------------------------------------------------------
+
+  void CCalendarWrapper::setInitDate(const CDate& initDate)
+  {
+    getCalendar(true)->setInitDate(initDate);
+    start_date = initDate.toString();
+  }
+
+  void CCalendarWrapper::setTimeOrigin(const CDate& timeOrigin)
+  {
+    getCalendar(true)->setTimeOrigin(timeOrigin);
+    time_origin = timeOrigin.toString();
+  }
+
+  //----------------------------------------------------------------
+
+  /*!
+  \brief Parse the calendar node
+  \param [in] node xmld node corresponding to the calendar definition
+  */
+  void CCalendarWrapper::parse(xml::CXMLNode& node)
+  {
+    SuperClass::parse(node);
+
+    // Try to create the calendar
+    createCalendar();
+  }
+
+  /*!
+  \brief Try to create the calendar from the parsed attributes
+  */
+  void CCalendarWrapper::createCalendar(void)
+  {
+    // Create the calendar if possible
+    if (calendar)
+    {
+      ERROR("CCalendarWrapper::createCalendar(void)",
+            << "Error: the calendar can only be defined once!");
+    }
+    else if (!type.isEmpty())
+    {
+#define DECLARE_CALENDAR(MType, eType)                                     \
+      if (type.getValue() == type_attr::eType)                             \
+        calendar = boost::shared_ptr<CCalendar>(new C##MType##Calendar());
+#include "calendar_type.conf"
+#undef DECLARE_CALENDAR
+
+      if (!calendar)
+        ERROR("CCalendarWrapper::parse(xml::CXMLNode& node)",
+              << "[ type = " << type.getStringValue() << " ] "
+              << "The calendar is not properly handled!");
+
+      // Set the timestep is available
+      if (!timestep.isEmpty())
+        calendar->setTimeStep(timestep.getValue());
+
+      // Parse and set the start date if available
+      if (!start_date.isEmpty())
+        calendar->setInitDate(CDate::FromString(start_date.getValue(), *calendar));
+
+      // Parse and set the time origin if available
+      if (!time_origin.isEmpty())
+        calendar->setTimeOrigin(CDate::FromString(time_origin.getValue(), *calendar));
+
+      // Notify the context about the calendar
+      CContext* context = CContext::getCurrent();
+      if (!context)
+        ERROR("CCalendarWrapper::createCalendar(void)", << "Impossible to set the calendar: no current context available.");
+      context->setCalendar(calendar);
+    }
+    else if (!start_date.isEmpty() || !time_origin.isEmpty())
+    {
+      ERROR("CCalendarWrapper::parse(xml::CXMLNode& node)",
+            << "The calendar type must be set before defining the start date or the time origin!");
+    }
+  }
+
+  /*!
+  \brief Try to update the timestep of the calendar with the corresponding attribute
+  */
+  void CCalendarWrapper::updateTimestep(void)
+  {
+    if (timestep.isEmpty())
+    {
+      ERROR("CCalendarWrapper::updateTimestep(void)",
+            << "Error: the timestep needs to be defined!");
+    }
+    else if (calendar)
+      calendar->setTimeStep(timestep.getValue());
+  }
+}
Index: XIOS/trunk/src/node/calendar_wrapper.hpp
===================================================================
--- XIOS/trunk/src/node/calendar_wrapper.hpp	(revision 549)
+++ XIOS/trunk/src/node/calendar_wrapper.hpp	(revision 549)
@@ -0,0 +1,86 @@
+#ifndef __XMLIO_CCalendarWrapper__
+#define __XMLIO_CCalendarWrapper__
+
+/// xios headers ///
+#include "xmlioserver_spl.hpp"
+#include "attribute_enum.hpp"
+#include "attribute_enum_impl.hpp"
+#include "declare_attribute.hpp"
+#include "object_template.hpp"
+
+#include "calendar.hpp"
+
+namespace xios {
+
+  /// ////////////////////// DÃ©clarations ////////////////////// ///
+  class CCalendarWrapperAttributes;
+  class CCalendarWrapper;
+  ///--------------------------------------------------------------
+
+  // Declare/Define CFileAttribute
+  BEGIN_DECLARE_ATTRIBUTE_MAP(CCalendarWrapper)
+#include "calendar_wrapper_attribute.conf"
+  END_DECLARE_ATTRIBUTE_MAP(CCalendarWrapper)
+
+  ///--------------------------------------------------------------
+  /*!
+    \class CCalendarWrapper
+    This class a simple wrapper for the calendar
+  */
+  class CCalendarWrapper
+    : public CObjectTemplate<CCalendarWrapper>
+    , public CCalendarWrapperAttributes
+  {
+    public :
+
+      /// typedef ///
+      typedef CObjectTemplate<CCalendarWrapper> SuperClass;
+      typedef CCalendarWrapperAttributes SuperClassAttribute;
+
+      //---------------------------------------------------------
+
+    public :
+
+      /// Constructeurs ///
+      CCalendarWrapper(void);
+      explicit CCalendarWrapper(const StdString& id);
+
+      /// Destructeur ///
+      virtual ~CCalendarWrapper(void);
+
+      /// Accesseurs statiques ///
+      static StdString GetName(void);
+      static StdString GetDefName(void);
+      static ENodeType GetType(void);
+
+      //---------------------------------------------------------
+
+    public :
+      // Parse xml calendar node
+      virtual void parse(xml::CXMLNode& node);
+      // Try to create the calendar from the current attributes
+      void createCalendar(void);
+      // Try to update the timestep of the calendar with the corresponding attribute
+      void updateTimestep(void);
+
+    public :
+      /// Accesseurs ///
+      boost::shared_ptr<CCalendar> getCalendar(bool checkValid = false) const;
+
+      const CDate& getInitDate() const;
+      const CDate& getTimeOrigin() const;
+
+      /// Mutateurs ///
+      void setInitDate(const CDate& initDate);
+      void setTimeOrigin(const CDate& timeOrigin);
+
+    private:
+      // Calendar of context
+      boost::shared_ptr<CCalendar> calendar;
+
+  }; // class CCalendarWrapper
+
+  typedef CCalendarWrapper CCalendarWrapperDefinition;
+} // namespace xios
+
+#endif // __XMLIO_CCalendarWrapper__
Index: XIOS/trunk/src/node/context.cpp
===================================================================
--- XIOS/trunk/src/node/context.cpp	(revision 546)
+++ XIOS/trunk/src/node/context.cpp	(revision 549)
@@ -17,5 +17,5 @@
 namespace xios {
 
-  shared_ptr<CContextGroup> CContext::root ;
+  shared_ptr<CContextGroup> CContext::root;
 
    /// ////////////////////// DÃ©finitions ////////////////////// ///
@@ -33,6 +33,6 @@
    CContext::~CContext(void)
    {
-     if (hasClient) delete client ;
-     if (hasServer) delete server ;
+     if (hasClient) delete client;
+     if (hasServer) delete server;
    }
 
@@ -50,5 +50,5 @@
    CContextGroup* CContext::getRoot(void)
    {
-      if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())) ;
+      if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName()));
       return root.get();
    }
@@ -73,64 +73,4 @@
    {
       this->calendar = newCalendar;
-      calendar_type.fromString(this->calendar->getId());
-      start_date.setValue(this->calendar->getInitDate());
-   }
-
-   //----------------------------------------------------------------
-   //! Process all information of calendar
-   void CContext::solveCalendar(void)
-   {
-      if (calendar_type.isEmpty())
-         ERROR(" CContext::solveCalendar(void)",
-               << "[ context id = " << this->getId() << " ] "
-               << "Impossible to define a calendar: the calendar type is missing.");
-      if (start_date.isEmpty())
-         ERROR(" CContext::solveCalendar(void)",
-               << "[ context id = " << this->getId() << " ] "
-               << "Impossible to define a calendar: the start date is missing.");
-      if (timestep.isEmpty())
-         ERROR(" CContext::solveCalendar(void)",
-               << "[ context id = " << this->getId() << " ] "
-               << "Impossible to define a calendar: the timestep is missing.");
-
-      if (this->calendar)
-      {
-        if (this->calendar->getId() != calendar_type.getStringValue()
-              || this->calendar->getInitDate() != start_date.getValue()
-              || (time_origin.isEmpty() && this->calendar->getTimeOrigin() != start_date.getValue())
-              || (!time_origin.isEmpty() && this->calendar->getTimeOrigin() != time_origin.getValue())
-              || this->calendar->getTimeStep() != timestep.getValue())
-          ERROR(" CContext::solveCalendar(void)",
-                << "[ context id = " << this->getId() << " ] "
-                << "Impossible to define a calendar again with new parameters.");
-        return;
-      }
-
-#define DECLARE_CALENDAR(MType, eType)                                             \
-  if (calendar_type.getValue() == eType)                                           \
-  {                                                                                \
-    if (time_origin.isEmpty())                                                     \
-      this->calendar = boost::shared_ptr<CCalendar>                                \
-          (new C##MType##Calendar(start_date.getValue()));                         \
-    else this->calendar = boost::shared_ptr<CCalendar>                             \
-          (new C##MType##Calendar(start_date.getValue(), time_origin.getValue())); \
-                                                                                   \
-    if (!start_date.getValue().setRelCalendar(*this->calendar))                    \
-      ERROR("CContext::solveCalendar(void)",                                       \
-            "start_date: Bad format or date not conform to the calendar");         \
-    if (!time_origin.getValue().setRelCalendar(*this->calendar))                   \
-      ERROR("CContext::solveCalendar(void)",                                       \
-            "time_origin: Bad format or date not conform to the calendar");        \
-                                                                                   \
-    this->calendar->setTimeStep(this->timestep.getValue());                        \
-                                                                                   \
-    return;                                                                        \
-  }
-#include "calendar_type.conf"
-#undef DECLARE_CALENDAR
-
-      ERROR("CContext::solveCalendar(void)",
-            << "[ calendar_type = " << calendar_type.getStringValue() << " ] "
-            << "The calendar is not properly handled!");
    }
 
@@ -182,5 +122,5 @@
 #define DECLARE_NODE(Name_, name_)    \
    if (name.compare(C##Name_##Definition::GetDefName()) == 0) \
-   { C##Name_##Definition::create(C##Name_##Definition::GetDefName()) -> parse(node) ; continue; }
+   { C##Name_##Definition::create(C##Name_##Definition::GetDefName()) -> parse(node); continue; }
 #define DECLARE_NODE_PAR(Name_, name_)
 #include "node_type.conf"
@@ -200,5 +140,5 @@
    void CContext::ShowTree(StdOStream & out)
    {
-      StdString currentContextId = CContext::getCurrent() -> getId() ;
+      StdString currentContextId = CContext::getCurrent() -> getId();
       std::vector<CContext*> def_vector =
          CContext::getRoot()->getChildList();
@@ -285,5 +225,5 @@
 //   {
 //      if (!this->hasId()) return;
-//      vector<CField*> allField = CField::getAll() ;
+//      vector<CField*> allField = CField::getAll();
 ////              = CObjectTemplate<CField>::GetAllVectobject(this->getId());
 //      std::vector<CField*>::iterator
@@ -301,5 +241,5 @@
    void CContext::CleanTree(void)
    {
-#define DECLARE_NODE(Name_, name_) C##Name_##Group::ClearAllAttributes();
+#define DECLARE_NODE(Name_, name_) C##Name_##Definition::ClearAllAttributes();
 #define DECLARE_NODE_PAR(Name_, name_)
 #include "node_type.conf"
@@ -310,6 +250,6 @@
    void CContext::initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer)
    {
-     hasClient=true ;
-     client = new CContextClient(this,intraComm, interComm, cxtServer) ;
+     hasClient=true;
+     client = new CContextClient(this,intraComm, interComm, cxtServer);
    }
 
@@ -325,5 +265,5 @@
    bool CContext::isInitialized(void)
    {
-     return hasClient ;
+     return hasClient;
    }
 
@@ -331,6 +271,6 @@
    void CContext::initServer(MPI_Comm intraComm,MPI_Comm interComm)
    {
-     hasServer=true ;
-     server = new CContextServer(this,intraComm,interComm) ;
+     hasServer=true;
+     server = new CContextServer(this,intraComm,interComm);
    }
 
@@ -338,5 +278,5 @@
    bool CContext::eventLoop(void)
    {
-     return server->eventLoop() ;
+     return server->eventLoop();
    }
 
@@ -346,9 +286,9 @@
       if (hasClient && !hasServer)
       {
-         client->finalize() ;
+         client->finalize();
       }
       if (hasServer)
       {
-        closeAllFile() ;
+        closeAllFile();
       }
    }
@@ -385,4 +325,7 @@
       this->sendAllAttributesToServer();
 
+      // Send all attributes of current calendar
+      CCalendarWrapper::get(CCalendarWrapper::GetDefName())->sendAllAttributesToServer();
+
       // We have enough information to send to server
       // First of all, send all enabled files
@@ -428,5 +371,5 @@
 ////        this->findEnabledFiles();
 //
-//        this->processEnabledFiles() ;
+//        this->processEnabledFiles();
 //
 //        this->solveAllGridRef();
@@ -445,5 +388,5 @@
 //
 //
-//      this->processEnabledFiles() ;
+//      this->processEnabledFiles();
 
 /*
@@ -464,5 +407,5 @@
       if (hasClient && !hasServer) CleanTree(); // Only on client side??
 //      if (hasClient) CleanTree();
-      if (hasClient) sendCreateFileHeader() ;
+      if (hasClient) sendCreateFileHeader();
    }
 
@@ -523,5 +466,5 @@
 
      // RÃ©solution des hÃ©ritages par rÃ©fÃ©rence au niveau des fichiers.
-      const vector<CFile*> allFiles=CFile::getAll() ;
+      const vector<CFile*> allFiles=CFile::getAll();
       const vector<CGrid*> allGrids= CGrid::getAll();
 
@@ -580,5 +523,5 @@
    {
 
-      if (SuperClass::dispatchEvent(event)) return true ;
+      if (SuperClass::dispatchEvent(event)) return true;
       else
       {
@@ -586,23 +529,23 @@
         {
            case EVENT_ID_CLOSE_DEFINITION :
-             recvCloseDefinition(event) ;
-             return true ;
-             break ;
+             recvCloseDefinition(event);
+             return true;
+             break;
            case EVENT_ID_UPDATE_CALENDAR :
-             recvUpdateCalendar(event) ;
-             return true ;
-             break ;
+             recvUpdateCalendar(event);
+             return true;
+             break;
            case EVENT_ID_CREATE_FILE_HEADER :
-             recvCreateFileHeader(event) ;
-             return true ;
-             break ;
+             recvCreateFileHeader(event);
+             return true;
+             break;
            case EVENT_ID_POST_PROCESS:
-             recvPostProcessing(event) ;
-             return true ;
-             break ;
+             recvPostProcessing(event);
+             return true;
+             break;
            default :
              ERROR("bool CContext::dispatchEvent(CEventServer& event)",
-                    <<"Unknown Event") ;
-           return false ;
+                    <<"Unknown Event");
+           return false;
          }
       }
@@ -612,13 +555,13 @@
    void CContext::sendCloseDefinition(void)
    {
-     CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION) ;
+     CEventClient event(getType(),EVENT_ID_CLOSE_DEFINITION);
      if (client->isServerLeader())
      {
-       CMessage msg ;
-       msg<<this->getIdServer() ;
-       event.push(client->getServerLeader(),1,msg) ;
-       client->sendEvent(event) ;
-     }
-     else client->sendEvent(event) ;
+       CMessage msg;
+       msg<<this->getIdServer();
+       event.push(client->getServerLeader(),1,msg);
+       client->sendEvent(event);
+     }
+     else client->sendEvent(event);
    }
 
@@ -629,5 +572,5 @@
       CBufferIn* buffer=event.subEvents.begin()->buffer;
       string id;
-      *buffer>>id ;
+      *buffer>>id;
       get(id)->closeDefinition();
    }
@@ -638,13 +581,13 @@
      if (!hasServer)
      {
-       CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR) ;
+       CEventClient event(getType(),EVENT_ID_UPDATE_CALENDAR);
        if (client->isServerLeader())
        {
-         CMessage msg ;
-         msg<<this->getIdServer()<<step ;
-         event.push(client->getServerLeader(),1,msg) ;
-         client->sendEvent(event) ;
+         CMessage msg;
+         msg<<this->getIdServer()<<step;
+         event.push(client->getServerLeader(),1,msg);
+         client->sendEvent(event);
        }
-       else client->sendEvent(event) ;
+       else client->sendEvent(event);
      }
    }
@@ -656,6 +599,6 @@
       CBufferIn* buffer=event.subEvents.begin()->buffer;
       string id;
-      *buffer>>id ;
-      get(id)->recvUpdateCalendar(*buffer) ;
+      *buffer>>id;
+      get(id)->recvUpdateCalendar(*buffer);
    }
 
@@ -663,7 +606,7 @@
    void CContext::recvUpdateCalendar(CBufferIn& buffer)
    {
-      int step ;
-      buffer>>step ;
-      updateCalendar(step) ;
+      int step;
+      buffer>>step;
+      updateCalendar(step);
    }
 
@@ -671,13 +614,13 @@
    void CContext::sendCreateFileHeader(void)
    {
-     CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER) ;
+     CEventClient event(getType(),EVENT_ID_CREATE_FILE_HEADER);
      if (client->isServerLeader())
      {
-       CMessage msg ;
-       msg<<this->getIdServer() ;
-       event.push(client->getServerLeader(),1,msg) ;
-       client->sendEvent(event) ;
-     }
-     else client->sendEvent(event) ;
+       CMessage msg;
+       msg<<this->getIdServer();
+       event.push(client->getServerLeader(),1,msg);
+       client->sendEvent(event);
+     }
+     else client->sendEvent(event);
    }
 
@@ -687,6 +630,6 @@
       CBufferIn* buffer=event.subEvents.begin()->buffer;
       string id;
-      *buffer>>id ;
-      get(id)->recvCreateFileHeader(*buffer) ;
+      *buffer>>id;
+      get(id)->recvCreateFileHeader(*buffer);
    }
 
@@ -694,5 +637,5 @@
    void CContext::recvCreateFileHeader(CBufferIn& buffer)
    {
-      createFileHeader() ;
+      createFileHeader();
    }
 
@@ -702,13 +645,13 @@
      if (!hasServer)
      {
-       CEventClient event(getType(),EVENT_ID_POST_PROCESS) ;
+       CEventClient event(getType(),EVENT_ID_POST_PROCESS);
        if (client->isServerLeader())
        {
-         CMessage msg ;
+         CMessage msg;
          msg<<this->getIdServer();
-         event.push(client->getServerLeader(),1,msg) ;
-         client->sendEvent(event) ;
+         event.push(client->getServerLeader(),1,msg);
+         client->sendEvent(event);
        }
-       else client->sendEvent(event) ;
+       else client->sendEvent(event);
      }
    }
@@ -726,4 +669,5 @@
    void CContext::recvPostProcessing(CBufferIn& buffer)
    {
+      CCalendarWrapper::get(CCalendarWrapper::GetDefName())->createCalendar();
       postProcessing();
 //      std::cout << "server context " << *this << std::endl;
@@ -751,6 +695,9 @@
      if (isPostProcessed) return;
 
-     // Solve calendar for both side: client and server
-      this->solveCalendar();
+      // Make sure the calendar was correctly created
+      if (!calendar)
+        ERROR("CContext::postProcessing()", << "A calendar must be defined for the context \"" << getId() << "!\"")
+      else if (calendar->getTimeStep() == NoneDu)
+        ERROR("CContext::postProcessing()", << "A timestep must be defined for the context \"" << getId() << "!\"")
 
       // Find all inheritance in xml structure
@@ -932,7 +879,7 @@
    void CContext::updateCalendar(int step)
    {
-      info(50)<<"updateCalendar : before : "<<calendar->getCurrentDate()<<endl ;
-      calendar->update(step) ;
-      info(50)<<"updateCalendar : after : "<<calendar->getCurrentDate()<<endl ;
+      info(50)<<"updateCalendar : before : "<<calendar->getCurrentDate()<<endl;
+      calendar->update(step);
+      info(50)<<"updateCalendar : after : "<<calendar->getCurrentDate()<<endl;
    }
 
@@ -940,5 +887,5 @@
    void CContext::createFileHeader(void )
    {
-      vector<CFile*>::const_iterator it ;
+      vector<CFile*>::const_iterator it;
 
       for (it=enabledFiles.begin(); it != enabledFiles.end(); it++)
@@ -951,5 +898,5 @@
    CContext* CContext::getCurrent(void)
    {
-     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()).get() ;
+     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()).get();
    }
 
@@ -971,9 +918,9 @@
   CContext* CContext::create(const StdString& id)
   {
-    CContext::setCurrent(id) ;
+    CContext::setCurrent(id);
 
     bool hasctxt = CContext::has(id);
     CContext* context = CObjectFactory::CreateObject<CContext>(id).get();
-    getRoot() ;
+    getRoot();
     if (!hasctxt) CGroupFactory::AddChild(root, context->getShared());
 
Index: XIOS/trunk/src/node/context.hpp
===================================================================
--- XIOS/trunk/src/node/context.hpp	(revision 546)
+++ XIOS/trunk/src/node/context.hpp	(revision 549)
@@ -5,5 +5,5 @@
 #include "xmlioserver_spl.hpp"
 //#include "node_type.hpp"
-#include "calendar.hpp"
+#include "calendar_wrapper.hpp"
 
 #include "declare_group.hpp"
@@ -16,6 +16,6 @@
 
 namespace xios {
-   class CContextClient ;
-   class CContextServer ;
+   class CContextClient;
+   class CContextServer;
 
 
@@ -51,5 +51,5 @@
            EVENT_ID_CREATE_FILE_HEADER,EVENT_ID_CONTEXT_FINALIZE,
            EVENT_ID_POST_PROCESS
-         } ;
+         };
 
          /// typedef ///
@@ -87,28 +87,25 @@
       public :
          // Initialize server or client
-         void initServer(MPI_Comm intraComm, MPI_Comm interComm) ;
-         void initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer=0) ;
-         bool isInitialized(void) ;
+         void initServer(MPI_Comm intraComm, MPI_Comm interComm);
+         void initClient(MPI_Comm intraComm, MPI_Comm interComm, CContext* cxtServer=0);
+         bool isInitialized(void);
 
          // Put sever or client into loop state
-         bool eventLoop(void) ;
-         bool serverLoop(void) ;
-         void clientLoop(void) ;
-
-         // Process all information of calendar
-         void solveCalendar(void);
+         bool eventLoop(void);
+         bool serverLoop(void);
+         void clientLoop(void);
 
          // Finalize a context
-         void finalize(void) ;
-         void closeDefinition(void) ;
+         void finalize(void);
+         void closeDefinition(void);
 
          // Some functions to process context
          void findAllEnabledFields(void);
-         void processEnabledFiles(void) ;
-         void solveAllInheritance(bool apply=true) ;
+         void processEnabledFiles(void);
+         void solveAllInheritance(bool apply=true);
          void findEnabledFiles(void);
-         void closeAllFile(void) ;
-         void updateCalendar(int step) ;
-         void createFileHeader(void ) ;
+         void closeAllFile(void);
+         void updateCalendar(int step);
+         void createFileHeader(void );
          void solveAllRefOfEnabledFields(bool sendToServer);
          void buildAllExpressionOfEnabledFields();
@@ -119,8 +116,8 @@
 
          // Send context close definition
-         void sendCloseDefinition(void) ;
+         void sendCloseDefinition(void);
          // There are something to send on closing context defintion
-         void sendUpdateCalendar(int step) ;
-         void sendCreateFileHeader(void) ;
+         void sendUpdateCalendar(int step);
+         void sendCreateFileHeader(void);
          void sendEnabledFiles();
          void sendEnabledFields();
@@ -132,9 +129,9 @@
 
          // Client side: Receive and process messages
-         static void recvUpdateCalendar(CEventServer& event) ;
-         void recvUpdateCalendar(CBufferIn& buffer) ;
-         static void recvCloseDefinition(CEventServer& event) ;
-         static void recvCreateFileHeader(CEventServer& event) ;
-         void recvCreateFileHeader(CBufferIn& buffer) ;
+         static void recvUpdateCalendar(CEventServer& event);
+         void recvUpdateCalendar(CBufferIn& buffer);
+         static void recvCloseDefinition(CEventServer& event);
+         static void recvCreateFileHeader(CEventServer& event);
+         void recvCreateFileHeader(CBufferIn& buffer);
          static void recvSolveInheritanceContext(CEventServer& event);
          void recvSolveInheritanceContext(CBufferIn& buffer);
@@ -143,5 +140,5 @@
 
          // dispatch event
-         static bool dispatchEvent(CEventServer& event) ;
+         static bool dispatchEvent(CEventServer& event);
 
       public:
@@ -191,17 +188,17 @@
 
          // Context root
-         static shared_ptr<CContextGroup> root ;
+         static shared_ptr<CContextGroup> root;
 
          // Determine context on client or not
-         bool hasClient ;
+         bool hasClient;
 
          // Determine context on server or not
-         bool hasServer ;
+         bool hasServer;
 
          // Concrete context server
-         CContextServer* server ;
+         CContextServer* server;
 
          // Concrete contex client
-         CContextClient* client ;
+         CContextClient* client;
 
       private:
Index: XIOS/trunk/src/node/node_enum.hpp
===================================================================
--- XIOS/trunk/src/node/node_enum.hpp	(revision 546)
+++ XIOS/trunk/src/node/node_enum.hpp	(revision 549)
@@ -17,5 +17,6 @@
          eGrid,gGrid,
          eVariable,gVariable,
-         eContext,gContext
+         eContext,gContext,
+         eCalendarWrapper
 
 //#include "node_type.conf"
Index: XIOS/trunk/src/object_factory_decl.cpp
===================================================================
--- XIOS/trunk/src/object_factory_decl.cpp	(revision 546)
+++ XIOS/trunk/src/object_factory_decl.cpp	(revision 549)
@@ -14,6 +14,6 @@
   template bool CObjectFactory::HasObject<U>(const StdString& context,const StdString & id); \
   template boost::shared_ptr<U> CObjectFactory::CreateObject<U>(const StdString & id ); \
-  template  StdString CObjectFactory::GenUId<U>(void) ; 
-  
+  template  StdString CObjectFactory::GenUId<U>(void);
+
   macro(CField)
   macro(CFile)
@@ -22,4 +22,5 @@
   macro(CDomain)
   macro(CContext)
+  macro(CCalendarWrapper)
   macro(CVariable)
 
Index: XIOS/trunk/src/object_template_decl.cpp
===================================================================
--- XIOS/trunk/src/object_template_decl.cpp	(revision 546)
+++ XIOS/trunk/src/object_template_decl.cpp	(revision 549)
@@ -12,18 +12,19 @@
 namespace xios
 {
-  template class CObjectTemplate<CContext> ;
-  template class CObjectTemplate<CField> ;
-  template class CObjectTemplate<CFile> ;
-  template class CObjectTemplate<CDomain> ;
-  template class CObjectTemplate<CGrid> ;
-  template class CObjectTemplate<CAxis> ;
-  template class CObjectTemplate<CVariable> ;
-  
-  template class CObjectTemplate<CContextGroup> ;
-  template class CObjectTemplate<CFieldGroup> ;
-  template class CObjectTemplate<CFileGroup> ;
-  template class CObjectTemplate<CDomainGroup> ;
-  template class CObjectTemplate<CGridGroup> ;
-  template class CObjectTemplate<CAxisGroup> ;
-  template class CObjectTemplate<CVariableGroup> ;
-  }
+  template class CObjectTemplate<CContext>;
+  template class CObjectTemplate<CCalendarWrapper>;
+  template class CObjectTemplate<CField>;
+  template class CObjectTemplate<CFile>;
+  template class CObjectTemplate<CDomain>;
+  template class CObjectTemplate<CGrid>;
+  template class CObjectTemplate<CAxis>;
+  template class CObjectTemplate<CVariable>;
+
+  template class CObjectTemplate<CContextGroup>;
+  template class CObjectTemplate<CFieldGroup>;
+  template class CObjectTemplate<CFileGroup>;
+  template class CObjectTemplate<CDomainGroup>;
+  template class CObjectTemplate<CGridGroup>;
+  template class CObjectTemplate<CAxisGroup>;
+  template class CObjectTemplate<CVariableGroup>;
+}
Index: XIOS/trunk/src/object_template_impl.hpp
===================================================================
--- XIOS/trunk/src/object_template_impl.hpp	(revision 546)
+++ XIOS/trunk/src/object_template_impl.hpp	(revision 549)
@@ -141,5 +141,6 @@
       void CObjectTemplate<T>::solveDescInheritance(bool apply, const CAttributeMap * const parent)
    {
-      SuperClassMap::setAttributes(parent, apply);
+      if (parent != NULL)
+         SuperClassMap::setAttributes(parent, apply);
    }
 
@@ -149,5 +150,5 @@
       void CObjectTemplate<T>::ClearAllAttributes(void)
    {
-      vector<T*> avect = CObjectTemplate<T>::getAll() ;
+      vector<T*> avect = CObjectTemplate<T>::getAll();
       typename vector<T*>::iterator
             it = avect.begin(), end = avect.end();
@@ -176,6 +177,6 @@
    {
       CAttributeMap & attrMap = *this;
-      CAttribute* attr=attrMap[id] ;
-      sendAttributToServer(*attr) ;
+      CAttribute* attr=attrMap[id];
+      sendAttributToServer(*attr);
    }
 
@@ -183,22 +184,22 @@
   void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr)
   {
-    CContext* context=CContext::getCurrent() ;
+    CContext* context=CContext::getCurrent();
 
     if (!context->hasServer)
     {
-       CContextClient* client=context->client ;
-
-       CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE) ;
+       CContextClient* client=context->client;
+
+       CEventClient event(getType(),EVENT_ID_SEND_ATTRIBUTE);
        if (client->isServerLeader())
        {
-         CMessage msg ;
-//         msg<<this->getId() ;
+         CMessage msg;
+//         msg<<this->getId();
          msg<<this->getIdServer();
-         msg<<attr.getName() ;
-         msg<<attr ;
-         event.push(client->getServerLeader(),1,msg) ;
-         client->sendEvent(event) ;
+         msg<<attr.getName();
+         msg<<attr;
+         event.push(client->getServerLeader(),1,msg);
+         client->sendEvent(event);
        }
-       else client->sendEvent(event) ;
+       else client->sendEvent(event);
     }
 
@@ -211,15 +212,15 @@
     CBufferIn* buffer=event.subEvents.begin()->buffer;
     string id,attrId;
-    *buffer>>id ;
+    *buffer>>id;
     CAttributeMap & attrMap = *get(id);
-    *buffer>>attrId ;
-    CAttribute* attr=attrMap[attrId] ;
-    info(50)<<"attribut recu "<<attrId<<"  " ;
-    if (attr->isEmpty()) info(50)<<"--> empty"<<endl ;
-    else info(50) /*<attr->getValue()*/<<endl ;
-    *buffer>>*attr ;
-     info(50)<<"attribut recu "<<attrId<<"  " ;
-    if (attr->isEmpty()) info(50)<<"--> empty"<<endl ;
-    else info(50) /*attr->getValue()*/<<endl ;
+    *buffer>>attrId;
+    CAttribute* attr=attrMap[attrId];
+    info(50)<<"attribut recu "<<attrId<<"  ";
+    if (attr->isEmpty()) info(50)<<"--> empty"<<endl;
+    else info(50) /*<attr->getValue()*/<<endl;
+    *buffer>>*attr;
+     info(50)<<"attribut recu "<<attrId<<"  ";
+    if (attr->isEmpty()) info(50)<<"--> empty"<<endl;
+    else info(50) /*attr->getValue()*/<<endl;
   }
 
@@ -230,12 +231,12 @@
       {
          case EVENT_ID_SEND_ATTRIBUTE :
-           recvAttributFromClient(event) ;
-           return true ;
-           break ;
+           recvAttributFromClient(event);
+           return true;
+           break;
 
          default :
-         return false ;
+         return false;
 //           ERROR("void CObjectTemplate<T>::recvEvent(CEventServer& event)",
-//                 <<"Unknown Event") ;
+//                 <<"Unknown Event");
       }
    }
@@ -244,5 +245,5 @@
    bool CObjectTemplate<T>::has(const string & id)
    {
-     return CObjectFactory::HasObject<T>(id) ;
+     return CObjectFactory::HasObject<T>(id);
    }
 
@@ -250,5 +251,5 @@
    bool CObjectTemplate<T>::has(const string& contextId, const string & id)
    {
-     return CObjectFactory::HasObject<T>(contextId,id) ;
+     return CObjectFactory::HasObject<T>(contextId,id);
    }
 
@@ -256,5 +257,5 @@
    T* CObjectTemplate<T>::get(const string & id)
    {
-     return CObjectFactory::GetObject<T>(id).get() ;
+     return CObjectFactory::GetObject<T>(id).get();
    }
 
@@ -262,5 +263,5 @@
    T* CObjectTemplate<T>::get(const T* ptr)
    {
-     return CObjectFactory::GetObject<T>(ptr).get() ;
+     return CObjectFactory::GetObject<T>(ptr).get();
    }
 
@@ -268,5 +269,5 @@
    shared_ptr<T> CObjectTemplate<T>::getShared(const T* ptr)
    {
-     return CObjectFactory::GetObject<T>(ptr) ;
+     return CObjectFactory::GetObject<T>(ptr);
    }
 
@@ -274,5 +275,5 @@
    shared_ptr<T> CObjectTemplate<T>::getShared(void)
    {
-     return CObjectFactory::GetObject<T>((T*)this) ;
+     return CObjectFactory::GetObject<T>((T*)this);
    }
 
@@ -281,9 +282,9 @@
    {
      const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>();
-     vector<T*> vect ;
+     vector<T*> vect;
 
      typename vector<shared_ptr<T> >::const_iterator it;
-     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ;
-     return vect ;
+     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get());
+     return vect;
    }
 
@@ -292,9 +293,9 @@
    {
      const vector< shared_ptr<T> >& shared_vect= CObjectFactory::GetObjectVector<T>(id);
-     vector<T*> vect ;
+     vector<T*> vect;
 
      typename vector<shared_ptr<T> >::const_iterator it;
-     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get()) ;
-     return vect ;
+     for(it=shared_vect.begin();it!=shared_vect.end();++it) vect.push_back(it->get());
+     return vect;
    }
 
@@ -302,5 +303,5 @@
    T* CObjectTemplate<T>::get(const string& contextId, const string & id)
    {
-     return CObjectFactory::GetObject<T>(contextId,id).get() ;
+     return CObjectFactory::GetObject<T>(contextId,id).get();
    }
 
@@ -308,5 +309,5 @@
    T* CObjectTemplate<T>::create(const string & id)
    {
-     return CObjectFactory::CreateObject<T>(id).get() ;
+     return CObjectFactory::CreateObject<T>(id).get();
    }   ///--------------------------------------------------------------
 
@@ -314,5 +315,5 @@
   T* CObjectTemplate<T>::get(void)
   {
-    return CObjectFactory::GetObject<T>((T*)this).get() ;
+    return CObjectFactory::GetObject<T>((T*)this).get();
   }
 
@@ -320,30 +321,30 @@
    void CObjectTemplate<T>::generateCInterface(ostream& oss)
    {
-     string className=getName() ;
-     int found=className.find_first_of("_") ;
-     if (found!=string::npos) className.replace(found,1,0,'x') ;
-
-     oss<<"/* ************************************************************************** *"<<iendl ;
-     oss<<" *               Interface auto generated - do not modify                   *"<<iendl ;
+     string className=getName();
+     int found=className.rfind("_group");
+     if (found!=string::npos) className.replace(found,1,0,'x');
+
+     oss<<"/* ************************************************************************** *"<<iendl;
+     oss<<" *               Interface auto generated - do not modify                   *"<<iendl;
      oss<<" * ************************************************************************** */"<<iendl;
-     oss<<iendl ;
-     oss<<"#include <boost/multi_array.hpp>"<<iendl ;
-     oss<<"#include <boost/shared_ptr.hpp>"<<iendl ;
+     oss<<iendl;
+     oss<<"#include <boost/multi_array.hpp>"<<iendl;
+     oss<<"#include <boost/shared_ptr.hpp>"<<iendl;
      oss<<"#include \"xmlioserver.hpp\""<<iendl;
-     oss<<"#include \"attribute_template.hpp\""<<iendl ;
+     oss<<"#include \"attribute_template.hpp\""<<iendl;
      oss<<"#include \"object_template.hpp\""<<iendl;
-     oss<<"#include \"group_template.hpp\""<<iendl ;
-     oss<<"#include \"icutil.hpp\""<<iendl ;
-     oss<<"#include \"icdate.hpp\""<<iendl ;
-     oss<<"#include \"timer.hpp\""<<iendl ;
-     oss<<"#include \"node_type.hpp\""<<iendl ;
-     oss<<iendl ;
-     oss<<"extern \"C\""<<iendl ;
-     oss<<"{"<<iendl++ ;
+     oss<<"#include \"group_template.hpp\""<<iendl;
+     oss<<"#include \"icutil.hpp\""<<iendl;
+     oss<<"#include \"icdate.hpp\""<<iendl;
+     oss<<"#include \"timer.hpp\""<<iendl;
+     oss<<"#include \"node_type.hpp\""<<iendl;
+     oss<<iendl;
+     oss<<"extern \"C\""<<iendl;
+     oss<<"{"<<iendl++;
      oss<<"typedef xios::"<<getStrType<T>()<<"*  "<<className<<"_Ptr;"<<iendl;
-     oss<<iendl ;
-     SuperClassMap::generateCInterface(oss,className) ;
-     oss<<iendl-- ;
-     oss<<"}"<<iendl ;
+     oss<<iendl;
+     SuperClassMap::generateCInterface(oss,className);
+     oss<<iendl--;
+     oss<<"}"<<iendl;
    }
 
@@ -351,23 +352,23 @@
    void CObjectTemplate<T>::generateFortran2003Interface(ostream& oss)
    {
-     string className=getName() ;
-     int found=className.find_first_of("_") ;
-     if (found!=string::npos) className.replace(found,1,0,'x') ;
-
-     oss<<"! * ************************************************************************** *"<<iendl ;
-     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl ;
+     string className=getName();
+     int found=className.rfind("_group");
+     if (found!=string::npos) className.replace(found,1,0,'x');
+
      oss<<"! * ************************************************************************** *"<<iendl;
-     oss<<"#include \"../fortran/xios_fortran_prefix.hpp\""<<iendl ;
-     oss<<iendl ;
-     oss<<"MODULE "<<className<<"_interface_attr"<<iendl++ ;
-     oss<<"USE, INTRINSIC :: ISO_C_BINDING"<<iendl ;
-     oss<<iendl ;
-     oss<<"INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99"<<iendl++ ;
-     oss<<iendl ;
-     oss<<iendl ;
-     SuperClassMap::generateFortran2003Interface(oss,className) ;
-     oss<<"END INTERFACE"<<iendl-- ;
-     oss<<iendl-- ;
-     oss<<"END MODULE "<<className<<"_interface_attr"<<iendl ;
+     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl;
+     oss<<"! * ************************************************************************** *"<<iendl;
+     oss<<"#include \"../fortran/xios_fortran_prefix.hpp\""<<iendl;
+     oss<<iendl;
+     oss<<"MODULE "<<className<<"_interface_attr"<<iendl++;
+     oss<<"USE, INTRINSIC :: ISO_C_BINDING"<<iendl;
+     oss<<iendl;
+     oss<<"INTERFACE ! Do not call directly / interface FORTRAN 2003 <-> C99"<<iendl++;
+     oss<<iendl;
+     oss<<iendl;
+     SuperClassMap::generateFortran2003Interface(oss,className);
+     oss<<"END INTERFACE"<<iendl--;
+     oss<<iendl--;
+     oss<<"END MODULE "<<className<<"_interface_attr"<<iendl;
    }
 
@@ -375,45 +376,45 @@
    void CObjectTemplate<T>::generateFortranInterface(ostream& oss)
    {
-     string className=getName() ;
-     int found=className.find_first_of('_') ;
-     if (found!=string::npos) className.erase(found,1) ;
+     string className=getName();
+     int found=className.rfind("_group");
+     if (found!=string::npos) className.erase(found,1);
      string superClassName=getName();
-     found=superClassName.find("_group") ;
-     if (found!=string::npos) superClassName.erase(found,6) ;
-
-     oss<<"! * ************************************************************************** *"<<iendl ;
-     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl ;
+     found=superClassName.find("_group");
+     if (found!=string::npos) superClassName.erase(found,6);
+
      oss<<"! * ************************************************************************** *"<<iendl;
-     oss<<"#include \"xios_fortran_prefix.hpp\""<<iendl ;
-     oss<<iendl ;
-     oss<<"MODULE i"<<className<<"_attr"<<iendl++ ;
-     oss<<"USE, INTRINSIC :: ISO_C_BINDING"<<iendl ;
-     oss<<"USE i"<<superClassName<<iendl ;
-     oss<<"USE "<<className<<"_interface_attr"<<iendl ;
-//     oss<<"TYPE txios("<<className<<")"<<iendl ;
-//     oss<<"  INTEGER(kind = C_INTPTR_T) :: daddr"<<iendl ;
-//     oss<<"END TYPE txios("<<className<<")"<<iendl ;
-     oss<<iendl-- ;
-     oss<<"CONTAINS"<<iendl++ ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterface_id(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterface_hdl(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterface_hdl_(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterfaceGet_id(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterfaceGet_hdl(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterfaceGet_hdl_(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterfaceIsDefined_id(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterfaceIsDefined_hdl(oss,className) ;
-     oss<<iendl ;
-     SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className) ;
-     oss<<iendl-- ;
-     oss<<"END MODULE i"<<className<<"_attr"<<iendl ;
+     oss<<"! *               Interface auto generated - do not modify                     *"<<iendl;
+     oss<<"! * ************************************************************************** *"<<iendl;
+     oss<<"#include \"xios_fortran_prefix.hpp\""<<iendl;
+     oss<<iendl;
+     oss<<"MODULE i"<<className<<"_attr"<<iendl++;
+     oss<<"USE, INTRINSIC :: ISO_C_BINDING"<<iendl;
+     oss<<"USE i"<<superClassName<<iendl;
+     oss<<"USE "<<className<<"_interface_attr"<<iendl;
+//     oss<<"TYPE txios("<<className<<")"<<iendl;
+//     oss<<"  INTEGER(kind = C_INTPTR_T) :: daddr"<<iendl;
+//     oss<<"END TYPE txios("<<className<<")"<<iendl;
+     oss<<iendl--;
+     oss<<"CONTAINS"<<iendl++;
+     oss<<iendl;
+     SuperClassMap::generateFortranInterface_id(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterface_hdl(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterface_hdl_(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterfaceGet_id(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterfaceGet_hdl(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterfaceGet_hdl_(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterfaceIsDefined_id(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterfaceIsDefined_hdl(oss,className);
+     oss<<iendl;
+     SuperClassMap::generateFortranInterfaceIsDefined_hdl_(oss,className);
+     oss<<iendl--;
+     oss<<"END MODULE i"<<className<<"_attr"<<iendl;
    }
 
Index: XIOS/trunk/src/test/test_client.f90
===================================================================
--- XIOS/trunk/src/test/test_client.f90	(revision 546)
+++ XIOS/trunk/src/test/test_client.f90	(revision 549)
@@ -8,13 +8,14 @@
   INTEGER :: size
   INTEGER :: ierr
-  
+
   CHARACTER(len=*),PARAMETER :: id="client"
   INTEGER :: comm
   TYPE(xios_duration) :: dtime
   TYPE(xios_date) :: date
+  CHARACTER(len=10) :: calendar_type
   TYPE(xios_context) :: ctx_hdl
   INTEGER,PARAMETER :: ni_glo=100
-  INTEGER,PARAMETER :: nj_glo=100 
-  INTEGER,PARAMETER :: llm=5 
+  INTEGER,PARAMETER :: nj_glo=100
+  INTEGER,PARAMETER :: llm=5
   DOUBLE PRECISION  :: lval(llm)=1
   TYPE(xios_field) :: field_hdl
@@ -22,5 +23,5 @@
   TYPE(xios_file) :: file_hdl
   LOGICAL :: ok
-  
+
   DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo
   DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm)
@@ -32,7 +33,7 @@
 
   CALL MPI_INIT(ierr)
-  
+
   CALL init_wait
- 
+
 !!! XIOS Initialization (get the local communicator)
 
@@ -40,6 +41,6 @@
 
   CALL MPI_COMM_RANK(comm,rank,ierr)
-  CALL MPI_COMM_SIZE(comm,size,ierr)  
-  
+  CALL MPI_COMM_SIZE(comm,size,ierr)
+
   DO j=1,nj_glo
     DO i=1,ni_glo
@@ -57,8 +58,8 @@
     nj=nj_glo/size
     IF (n<MOD(nj_glo,size)) nj=nj+1
-    IF (n==rank) exit 
+    IF (n==rank) exit
     jbegin=jbegin+nj
   ENDDO
-  
+
   iend=ibegin+ni-1 ; jend=jbegin+nj-1
 
@@ -67,10 +68,12 @@
   lat(:,:)=lat_glo(ibegin:iend,jbegin:jend)
   field_A(1:ni,1:nj,:)=field_A_glo(ibegin:iend,jbegin:jend,:)
-  
+
   CALL xios_context_initialize("test",comm)
   CALL xios_get_handle("test",ctx_hdl)
   CALL xios_set_current_context(ctx_hdl)
-  
-  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
+
+  CALL xios_get_calendar_type(calendar_type)
+  PRINT *, "calendar_type = ", calendar_type
+
   CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ;
   CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj)
@@ -78,22 +81,27 @@
   CALL xios_set_domain_attr("domain_A",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/)))
   CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
-  
+
   CALL xios_get_handle("field_definition",fieldgroup_hdl)
   CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")
   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")
-  
+
   CALL xios_get_handle("output",file_hdl)
   CALL xios_add_child(file_hdl,field_hdl)
   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C")
-    
- 
+
   dtime%second = 3600
-  CALL xios_set_context_attr("test", timestep=dtime)
+  CALL xios_set_timestep(dtime)
 
-  ! Create the calendar before closing the context definition
-  ! so that calendar operations can be used
-  CALL xios_set_calendar()
-  CALL xios_get_context_attr("test", time_origin=date)
+  ! The calendar is created as soon as the calendar type is defined. This way
+  ! calendar operations can be used before the context definition is closed
+  CALL xios_get_time_origin(date)
+  PRINT *, "--> year length = ", xios_get_year_length_in_seconds(date%year)
+  PRINT *, "--> day length = ", xios_get_day_length_in_seconds()
   PRINT *, "time_origin = ", date
+  PRINT *, "xios_date_get_second_of_year(time_origin) = ", xios_date_get_second_of_year(date)
+  PRINT *, "xios_date_get_day_of_year(time_origin) = ", xios_date_get_day_of_year(date)
+  PRINT *, "xios_date_get_fraction_of_year(time_origin) = ", xios_date_get_fraction_of_year(date)
+  PRINT *, "xios_date_get_second_of_day(time_origin) = ", xios_date_get_second_of_day(date)
+  PRINT *, "xios_date_get_fraction_of_day(time_origin) = ", xios_date_get_fraction_of_day(date)
   dtime%timestep = 1
   dtime = 0.5 * dtime
@@ -103,8 +111,8 @@
   PRINT *, "xios_date_convert_to_seconds(date) = ", xios_date_convert_to_seconds(date)
   PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour)
-  
+
   ni=0 ; lonvalue(:)=0
   CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue=lonvalue)
-  
+
   print *,"ni",ni
   print *,"lonvalue",lonvalue ;
@@ -113,5 +121,5 @@
   PRINT *,"field_A : attribute enabled is defined ? ",ok
   CALL xios_close_context_definition()
-  
+
   PRINT*,"field field_A is active ? ",xios_field_is_active("field_A")
   DO ts=1,24*10
@@ -123,11 +131,11 @@
   CALL xios_context_finalize()
   CALL xios_finalize()
-  
+
   CALL MPI_FINALIZE(ierr)
-  
+
 END PROGRAM test_client
 
 
-  
 
-  
+
+
Index: XIOS/trunk/src/test/test_complete.f90
===================================================================
--- XIOS/trunk/src/test/test_complete.f90	(revision 546)
+++ XIOS/trunk/src/test/test_complete.f90	(revision 549)
@@ -8,13 +8,12 @@
   INTEGER :: size_loc
   INTEGER :: ierr
-  
+
   CHARACTER(len=*),PARAMETER :: id="client"
   INTEGER :: comm
-  TYPE(xios_date)      :: start_date, time_origin
   TYPE(xios_duration)  :: dtime
   TYPE(xios_context) :: ctx_hdl
   INTEGER,PARAMETER :: ni_glo=100
-  INTEGER,PARAMETER :: nj_glo=100 
-  INTEGER,PARAMETER :: llm=5 
+  INTEGER,PARAMETER :: nj_glo=100
+  INTEGER,PARAMETER :: llm=5
   DOUBLE PRECISION  :: lval(llm)=1
   TYPE(xios_field) :: field_hdl
@@ -34,7 +33,7 @@
 
   CALL MPI_INIT(ierr)
-  
+
   CALL init_wait
- 
+
 !!! XIOS Initialization (get the local communicator)
 
@@ -42,6 +41,6 @@
 
   CALL MPI_COMM_RANK(comm,rank,ierr)
-  CALL MPI_COMM_SIZE(comm,size_loc,ierr)  
-  
+  CALL MPI_COMM_SIZE(comm,size_loc,ierr)
+
 
 !###########################################################################
@@ -66,8 +65,8 @@
     nj=nj_glo/size_loc
     IF (n<MOD(nj_glo,size_loc)) nj=nj+1
-    IF (n==rank) exit 
+    IF (n==rank) exit
     jbegin=jbegin+nj
   ENDDO
-  
+
   iend=ibegin+ni-1 ; jend=jbegin+nj-1
 
@@ -76,5 +75,5 @@
   lat(:,:)=lat_glo(ibegin:iend,jbegin:jend)
   field_A_atm(1:ni,1:nj,:)=field_A_glo(ibegin:iend,jbegin:jend,:)
- 
+
 
 !!! Context ATMOSPHERE
@@ -83,10 +82,8 @@
   CALL xios_get_handle("atmosphere",ctx_hdl)
   CALL xios_set_current_context(ctx_hdl)
-  
-  CALL xios_set_context_attr("atmosphere",calendar_type="Gregorian")
-  start_date = xios_date(2000, 01, 01, 00, 00, 00)
-  CALL xios_set_context_attr("atmosphere",start_date=start_date)
-  time_origin = xios_date(1999, 01, 01, 15, 00, 00)
-  CALL xios_set_context_attr("atmosphere",time_origin=time_origin)
+
+  CALL xios_define_calendar(type="Gregorian", &
+                            start_date=xios_date(2000, 01, 01, 00, 00, 00), &
+                            time_origin=xios_date(1999, 01, 01, 15, 00, 00))
 
   CALL xios_set_axis_attr("axis_atm",size=llm ,value=lval) ;
@@ -104,5 +101,5 @@
   CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
 
-!!! CrÃ©ation d un nouveau champ 
+!!! CrÃ©ation d un nouveau champ
 
   CALL xios_get_handle("field_definition",fieldgroup_hdl)
@@ -112,5 +109,5 @@
 
   CALL xios_set_attr(field_hdl,field_ref="field_A_atm",name="field_B_atm")
-  
+
 !!! Affectation de ce nouveau champ au fichier avec un nouveau nom
 
@@ -118,15 +115,15 @@
   CALL xios_add_child(file_hdl,field_hdl)
   CALL xios_set_attr(field_hdl,field_ref="field_B_atm",name="field_C_atm")
-    
+
 !!! Definition du timestep
 
   dtime%second=3600
-  CALL xios_set_context_attr("atmosphere", timestep=dtime)
-    
+  CALL xios_set_timestep(timestep=dtime)
+
 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalitÃ©)
 
   ni=0 ; lonvalue(:)=0
   CALL xios_get_domain_attr("domain_atm",ni=ni,lonvalue=lonvalue)
-    
+
   PRINT *,"ni",ni
   PRINT *,"lonvalue",lonvalue ;
@@ -137,6 +134,6 @@
 
 !!! Test des valeurs des champs/fichiers
-  
-  !!! Attribut defini ? 
+
+  !!! Attribut defini ?
 
   CALL xios_is_defined_field_attr("field_A_atm",enabled=ok)
@@ -144,9 +141,9 @@
 
   !!! Recuperer la valeur d un attribut
-  
+
   CALL xios_get_field_attr("field_A_atm",name=crname)
   PRINT *,"field_A_atm : attribute name is : ",TRIM(crname)
 
-  !!! Champ actif (besoin de fournir la valeur) ? 
+  !!! Champ actif (besoin de fournir la valeur) ?
 
     PRINT*,"field field_A_atm is active ? ",xios_field_is_active("field_A_atm")
@@ -173,10 +170,8 @@
   CALL xios_get_handle("surface",ctx_hdl)
   CALL xios_set_current_context(ctx_hdl)
-  
-  CALL xios_set_context_attr("surface",calendar_type="Gregorian")
-  start_date = xios_date(2000, 01, 01, 00, 00, 00)
-  CALL xios_set_context_attr("surface",start_date=start_date)
-  time_origin = xios_date(1999, 01, 01, 15, 00, 00)
-  CALL xios_set_context_attr("surface",time_origin=time_origin)
+
+  CALL xios_define_calendar(type="Gregorian", &
+                            start_date=xios_date(2000, 01, 01, 00, 00, 00), &
+                            time_origin=xios_date(1999, 01, 01, 15, 00, 00))
 
   CALL xios_set_axis_attr("axis_srf",size=llm ,value=lval) ;
@@ -186,5 +181,5 @@
   CALL xios_set_domain_attr("domain_srf",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/)))
 
-!!! CrÃ©ation d un nouveau champ 
+!!! CrÃ©ation d un nouveau champ
 
   CALL xios_get_handle("field_definition",fieldgroup_hdl)
@@ -194,5 +189,5 @@
 
   CALL xios_set_attr(field_hdl,field_ref="field_A_srf",name="field_B_srf")
-  
+
 !!! Affectation de ce nouveau champ au fichier avec un nouveau nom
 
@@ -200,15 +195,15 @@
   CALL xios_add_child(file_hdl,field_hdl)
   CALL xios_set_attr(field_hdl,field_ref="field_B_srf",name="field_C_srf")
-    
+
 !!! Definition du timestep
 
   dtime%second=1800
-  CALL xios_set_context_attr("surface", timestep=dtime)
-    
+  CALL xios_set_timestep(timestep=dtime)
+
 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalitÃ©)
 
   ni=0 ; lonvalue(:)=0
   CALL xios_get_domain_attr("domain_srf",ni=ni,lonvalue=lonvalue)
-    
+
   PRINT *,"ni",ni
   PRINT *,"lonvalue",lonvalue ;
@@ -226,5 +221,5 @@
 
       CALL xios_get_handle("atmosphere",ctx_hdl)
-      CALL xios_set_current_context(ctx_hdl)    
+      CALL xios_set_current_context(ctx_hdl)
 
 !!! Mise a jour du pas de temps
@@ -239,5 +234,5 @@
 
       CALL xios_get_handle("surface",ctx_hdl)
-      CALL xios_set_current_context(ctx_hdl)    
+      CALL xios_set_current_context(ctx_hdl)
 
 !!! Mise a jour du pas de temps
@@ -257,21 +252,21 @@
 
 !!! Fin des contextes
-    
+
     CALL xios_context_finalize()
     CALL xios_get_handle("atmosphere",ctx_hdl)
-    CALL xios_set_current_context(ctx_hdl)    
+    CALL xios_set_current_context(ctx_hdl)
     CALL xios_context_finalize()
-    
+
 !!! Fin de XIOS
 
     CALL xios_finalize()
-  
+
     CALL MPI_FINALIZE(ierr)
-  
+
   END PROGRAM test_complete
 
 
 
-  
-
-  
+
+
+
Index: XIOS/trunk/src/test/test_cs.f90
===================================================================
--- XIOS/trunk/src/test/test_cs.f90	(revision 546)
+++ XIOS/trunk/src/test/test_cs.f90	(revision 549)
@@ -5,18 +5,18 @@
   INTEGER :: size
   INTEGER :: ierr
-  
+
   CALL MPI_INIT(ierr)
   CALL MPI_COMM_RANK(MPI_COMM_WORLD,rank,ierr)
   CALL MPI_COMM_SIZE(MPI_COMM_WORLD,size,ierr)
-  
+
   IF (rank<11) THEN
    CALL client("client",rank,11)
-  ELSE 
+  ELSE
     CALL server
   ENDIF
-  
-  
+
+
   CALL MPI_FINALIZE(ierr)
-  
+
 END PROGRAM test_cs
 
@@ -32,13 +32,13 @@
   TYPE(xios_duration) :: dtime
   TYPE(xios_context) :: ctx_hdl
-  INTEGER,PARAMETER :: ni_glo=100 
-  INTEGER,PARAMETER :: nj_glo=100 
-  INTEGER,PARAMETER :: llm=3 
+  INTEGER,PARAMETER :: ni_glo=100
+  INTEGER,PARAMETER :: nj_glo=100
+  INTEGER,PARAMETER :: llm=3
   DOUBLE PRECISION  :: lval(llm)=(/1.0,2.0,3.0/)
   TYPE(xios_field) :: field_hdl
   TYPE(xios_fieldgroup) :: fieldgroup_hdl
   TYPE(xios_file) :: file_hdl
-  
-  
+
+
   DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo
   DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm)
@@ -47,9 +47,9 @@
   INTEGER :: ni,ibegin,iend,nj,jbegin,jend,data_ibegin,data_ni
   INTEGER :: i,j,k,l,ts,n,nij_begin
-  
-  
+
+
   CALL init_wait
-  
-  
+
+
   DO j=1,nj_glo
     DO i=1,ni_glo
@@ -63,5 +63,5 @@
   ni=ni_glo ; ibegin=1
 
-  
+
   nij_begin=1
   DO n=0,size-1
@@ -70,5 +70,5 @@
     IF (n==rank) THEN
       ibegin=1 ; iend=ni_glo ; ni=iend-ibegin+1
-      jbegin=(nij_begin-1)/ni_glo +1 
+      jbegin=(nij_begin-1)/ni_glo +1
       jend=MOD(nij_begin-1 + data_ni-1,ni_glo) +1
       nj = jend-jbegin+1
@@ -79,5 +79,5 @@
     ENDIF
   ENDDO
-  
+
 
   ALLOCATE(lon(ni),lat(nj),field_A(data_ni,llm),lonvalue(ni*nj))
@@ -92,8 +92,8 @@
     field_A(k,:)=field_A_glo(i,j,:)
   ENDDO
-  
+
   mask(:,:)=.TRUE.
   mask(1:ni,6)=.TRUE.
-  
+
 
   CALL xios_initialize(id,return_comm=comm)
@@ -102,38 +102,35 @@
   CALL xios_get_handle("test",ctx_hdl)
   CALL xios_set_current_context(ctx_hdl)
-  
-  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
-  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
-  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
-!  CALL xios_set_context_attr("test",start_date="01/01/2000 - 00:00:00")
-  CALL xios_set_context_attr("test",calendar_type="Gregorian") 
+
+! CALL xios_define_calendar(type="Gregorian")
+! CALL xios_set_start_date(start_date=xios_date(2000, 01, 01, 00, 00, 00))
   CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ;
   CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, iend=iend,jbegin=jbegin,jend=jend)
-!  CALL xios_set_domain_attr("domain_A",zoom_ni=10,zoom_ibegin=5,zoom_nj=nj_glo,zoom_jbegin=1)
+! CALL xios_set_domain_attr("domain_A",zoom_ni=10,zoom_ibegin=5,zoom_nj=nj_glo,zoom_jbegin=1)
   CALL xios_set_domain_attr("domain_A",data_dim=1, data_ibegin=data_ibegin, data_ni=data_ni)
   CALL xios_set_domain_attr("domain_A",lonvalue=lon,latvalue=lat)
-!  CALL xios_set_domain_attr("domain_A",mask=mask)
+! CALL xios_set_domain_attr("domain_A",mask=mask)
   CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
-  
+
   CALL xios_get_handle("field_definition",fieldgroup_hdl)
   CALL xios_add_child(fieldgroup_hdl,field_hdl,"field_B")
   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_B")
-  
+
   CALL xios_get_handle("output",file_hdl)
   CALL xios_add_child(file_hdl,field_hdl)
   CALL xios_set_attr(field_hdl,field_ref="field_A",name="field_C")
-    
- 
+
+
     dtime%second=3600
-    CALL xios_set_context_attr("test", timestep=dtime)
-    
+    CALL xios_set_timestep(timestep=dtime)
+
 !    ni=0 ; lonvalue(:)=0
 !    CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue=lonvalue)
-    
+
 !    print *,"ni",ni
 !    print *,"lonvalue",lonvalue ;
 
     CALL xios_close_context_definition()
-    
+
     PRINT*,"field field_A is active ? ",xios_field_is_active("field_A")
     DO ts=1,24*10
@@ -142,20 +139,20 @@
       CALL wait_us(5000) ;
     ENDDO
-  
+
     CALL xios_context_finalize()
     CALL xios_finalize()
-     
+
   END SUBROUTINE client
-  
 
-  
+
+
   SUBROUTINE server
   USE xios
   IMPLICIT NONE
-  
+
     CALL xios_init_server
- 
+
   END SUBROUTINE server
-  
 
-  
+
+
Index: XIOS/trunk/src/test/test_new_features.f90
===================================================================
--- XIOS/trunk/src/test/test_new_features.f90	(revision 546)
+++ XIOS/trunk/src/test/test_new_features.f90	(revision 549)
@@ -69,5 +69,5 @@
 
   ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj))
-!  ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm,llm),lonvalue(ni*nj))
+! ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm,llm),lonvalue(ni*nj))
   lon(:,:)=lon_glo(ibegin:iend,jbegin:jend)
   lat(:,:)=lat_glo(ibegin:iend,jbegin:jend)
@@ -78,7 +78,7 @@
   CALL xios_set_current_context(ctx_hdl)
 
-  CALL xios_set_context_attr("test",calendar_type="Gregorian")
+! CALL xios_define_calendar(type="Gregorian")
   CALL xios_set_axis_attr("axis_A",size=llm ,value=lval) ;
-!  CALL xios_set_axis_attr("axis_B",size=llm ,value=lval2) ;
+! CALL xios_set_axis_attr("axis_B",size=llm ,value=lval2) ;
   CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj)
   CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
@@ -96,5 +96,5 @@
 
     dtime%second=3600
-    CALL xios_set_context_attr("test", timestep=dtime)
+!   CALL xios_set_timestep(timestep=dtime)
 
     ni=0 ; lonvalue(:)=0
Index: XIOS/trunk/src/test/test_unstruct_complete.f90
===================================================================
--- XIOS/trunk/src/test/test_unstruct_complete.f90	(revision 546)
+++ XIOS/trunk/src/test/test_unstruct_complete.f90	(revision 549)
@@ -8,14 +8,14 @@
   INTEGER :: mpi_size
   INTEGER :: ierr
-  
+
   CHARACTER(len=*),PARAMETER :: id="client"
   INTEGER :: comm
   TYPE(xios_duration) :: dtime
   TYPE(xios_context) :: ctx_hdl
-  INTEGER, PARAMETER :: nlon=60 
+  INTEGER, PARAMETER :: nlon=60
   INTEGER, PARAMETER :: nlat=30
   INTEGER,PARAMETER :: ni_glo=100
-  INTEGER,PARAMETER :: nj_glo=100 
-  INTEGER,PARAMETER :: llm=5 
+  INTEGER,PARAMETER :: nj_glo=100
+  INTEGER,PARAMETER :: llm=5
   DOUBLE PRECISION  :: lval(llm)=1
   TYPE(xios_field) :: field_hdl
@@ -23,5 +23,5 @@
   TYPE(xios_file) :: file_hdl
   LOGICAL :: ok
-  
+
   DOUBLE PRECISION,ALLOCATABLE :: lon_glo(:),lat_glo(:)
   DOUBLE PRECISION,ALLOCATABLE :: bounds_lon_glo(:,:),bounds_lat_glo(:,:)
@@ -42,11 +42,11 @@
   INTEGER,ALLOCATABLE :: data_i_index(:)
   DOUBLE PRECISION,ALLOCATABLE :: field_A_compressed(:,:)
-  
+
   CALL xios_initialize(id,return_comm=comm)
   CALL MPI_COMM_RANK(comm,mpi_rank,ierr)
   CALL MPI_COMM_SIZE(comm,mpi_size,ierr)
-  
+
   CALL init_wait
-  
+
   ncell_glo=0
   DO j=1,nlat
@@ -55,5 +55,5 @@
     ncell_glo=ncell_glo+n
   ENDDO
-  
+
   ALLOCATE(lon_glo(ncell_glo))
   ALLOCATE(lat_glo(ncell_glo))
@@ -63,5 +63,5 @@
   ALLOCATE(field_A_glo(ncell_glo,llm))
   ALLOCATE(mask_glo(ncell_glo))
-   
+
   ind=0
   DO j=1,nlat
@@ -70,5 +70,5 @@
     if (j==nlat) PRINT*,"--- ",n
     IF (n<8) n=8
-    
+
     DO i=1,n
       ind=ind+1
@@ -76,21 +76,21 @@
       ilon=i-0.5
       ilat=j-0.5
-      
+
       lat_glo(ind)= 90-(ilat*180./nlat)
       lon_glo(ind)= (ilon*360./n)
-      
- 
+
+
       bounds_lat_glo(1,ind)= 90-((ilat-0.5)*180./nlat)
       bounds_lon_glo(1,ind)=((ilon-0.5)*360./n)
-      
+
       bounds_lat_glo(2,ind)= 90-((ilat-0.5)*180./nlat)
-      bounds_lon_glo(2,ind)=((ilon+0.5)*360./n) 
-          
+      bounds_lon_glo(2,ind)=((ilon+0.5)*360./n)
+
       bounds_lat_glo(3,ind)= 90-((ilat+0.5)*180./nlat)
-      bounds_lon_glo(3,ind)=((ilon+0.5)*360./n)     
+      bounds_lon_glo(3,ind)=((ilon+0.5)*360./n)
 
       bounds_lat_glo(4,ind)= 90-((ilat+0.5)*180./nlat)
       bounds_lon_glo(4,ind)=((ilon-0.5)*360./n)
-      
+
     ENDDO
   ENDDO
@@ -99,5 +99,5 @@
   rank=(mpi_size-1)/2
   ncell_x=sqrt(ncell_glo*1./mpi_size)
-  
+
   j1=nlat/2
   DO WHILE(rank>=0)
@@ -106,15 +106,15 @@
     n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
     np = MIN(n/ncell_x,rank+1) ;
-    if (j2==1) np=rank+1 
-    
+    if (j2==1) np=rank+1
+
     PRINT *,"domain ",j2,j1,rank,np ;
-    DO j=j2,j1  
+    DO j=j2,j1
       n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
       IF (n<8) n=8
       DO i=1,n
         ind=list_ind(i,j)
-        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN 
+        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN
           i_index_glo(ind) = rank - (i-1)/(n/np+1)
-        ELSE 
+        ELSE
           i_index_glo(ind) = rank-(MOD(n,np)+ (i-1-MOD(n,np)*(n/np+1))/(n/np))
         ENDIF
@@ -124,8 +124,8 @@
     j1=j2-1
   ENDDO
-        
+
   rank=(mpi_size-1)/2+1
   ncell_x=sqrt(ncell_glo*1./mpi_size)
-  
+
   j1=nlat/2+1
   DO WHILE(rank<=mpi_size-1)
@@ -134,15 +134,15 @@
     n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
     np = MIN(n/ncell_x,mpi_size-rank) ;
-    if (j2==nlat) np=mpi_size-rank 
-    
+    if (j2==nlat) np=mpi_size-rank
+
     PRINT *,"domain ",j2,j1,rank,np ;
-    DO j=j1,j2  
+    DO j=j1,j2
       n=NINT(COS(Pi/2-(j-0.5)*PI/nlat)*nlon)
       IF (n<8) n=8
       DO i=1,n
         ind=list_ind(i,j)
-        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN 
+        IF ( (i-1) < MOD(n,np)*(n/np+1)) THEN
           i_index_glo(ind) = rank + (i-1)/(n/np+1)
-        ELSE 
+        ELSE
           i_index_glo(ind) = rank+(MOD(n,np)+ (i-1-MOD(n,np)*(n/np+1))/(n/np))
         ENDIF
@@ -152,5 +152,5 @@
     j1=j2+1
   ENDDO
-    
+
   ncell=0
   DO ind=1,ncell_glo
@@ -183,5 +183,5 @@
     ENDIF
   ENDDO
-  
+
   ALLOCATE(field_A_compressed(data_n_index,llm))
   ALLOCATE(data_i_index(data_n_index))
@@ -194,11 +194,13 @@
     ENDIF
   ENDDO
-      
-  
-  
+
   CALL xios_context_initialize("surface",comm)
   CALL xios_get_handle("surface",ctx_hdl)
   CALL xios_set_current_context(ctx_hdl)
-  
+
+  CALL xios_define_calendar(type="Julian", &
+                            start_date=xios_date(2012, 03, 01, 15, 00, 00), &
+                            time_origin=xios_date(2012, 02, 29, 15, 00, 00))
+
   CALL xios_set_axis_attr("axis_srf",size=llm ,value=lval) ;
   CALL xios_set_domain_attr("domain_srf",ni_glo=ncell_glo, ni=ncell, ibegin=1, i_index=RESHAPE(i_index,(/ncell,1/) ))
@@ -206,22 +208,22 @@
   CALL xios_set_domain_attr("domain_srf",lonvalue=lon,latvalue=lat)
   CALL xios_set_domain_attr("domain_srf", nvertex=4, bounds_lon=bounds_lon, bounds_lat=bounds_lat )
-    
- 
+
+
   dtime%second=3600
   CALL xios_set_context_attr("surface", timestep=dtime)
   CALL xios_close_context_definition()
-    
+
    DO ts=1,24*10
      CALL xios_update_calendar(ts)
      CALL xios_send_field("field_A_srf",field_A_compressed)
     ENDDO
-  
+
     CALL xios_context_finalize()
     CALL xios_finalize()
-  
+
   END PROGRAM test_unstruct_complete
 
 
-  
-
-  
+
+
+
Index: XIOS/trunk/src/test/test_xios_interface.f90
===================================================================
--- XIOS/trunk/src/test/test_xios_interface.f90	(revision 546)
+++ XIOS/trunk/src/test/test_xios_interface.f90	(revision 549)
@@ -96,9 +96,7 @@
   CALL xios_set_current_context(ctx_hdl)
 
-  CALL xios_set_context_attr("atmosphere",calendar_type="Gregorian")
-  start_date = xios_date(2000, 01, 01, 00, 00, 00)
-  CALL xios_set_context_attr("atmosphere",start_date=start_date)
-  time_origin = xios_date(1999, 01, 01, 15, 00, 00)
-  CALL xios_set_context_attr("atmosphere",time_origin=time_origin)
+  CALL xios_define_calendar(type="Gregorian", &
+                            start_date=xios_date(2000, 01, 01, 00, 00, 00), &
+                            time_origin=xios_date(1999, 01, 01, 15, 00, 00))
 
   CALL xios_set_axis_attr("axis_atm",size=llm ,value=lval) ;
@@ -131,5 +129,5 @@
 
   dtime%second=3600
-  CALL xios_set_context_attr("atmosphere", timestep=dtime)
+  CALL xios_set_timestep(timestep=dtime)
 
 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalitÃ©)
@@ -183,9 +181,7 @@
   CALL xios_set_current_context(ctx_hdl)
 
-  CALL xios_set_context_attr("surface",calendar_type="Gregorian")
-  start_date = xios_date(2000, 01, 01, 00, 00, 00)
-  CALL xios_set_context_attr("surface",start_date=start_date)
-  time_origin = xios_date(1999, 01, 01, 15, 00, 00)
-  CALL xios_set_context_attr("surface",time_origin=time_origin)
+  CALL xios_define_calendar(type="Gregorian", &
+                            start_date=xios_date(2000, 01, 01, 00, 00, 00), &
+                            time_origin=xios_date(1999, 01, 01, 15, 00, 00))
 
   CALL xios_set_axis_attr("axis_srf",size=llm ,value=lval) ;
@@ -213,5 +209,5 @@
 
   dtime%second=1800
-  CALL xios_set_context_attr("surface", timestep=dtime)
+  CALL xios_set_timestep(timestep=dtime)
 
 !!! Recupration des valeurs des longitudes et de taille des domaines locaux (pour test de fonctionnalitÃ©)
Index: XIOS/trunk/src/type/type_util.hpp
===================================================================
--- XIOS/trunk/src/type/type_util.hpp	(revision 546)
+++ XIOS/trunk/src/type/type_util.hpp	(revision 549)
@@ -5,5 +5,5 @@
 namespace xios
 {
-    class CDomain ;
+    class CDomain;
     class CDomainGroup;
     class CField;
@@ -17,10 +17,11 @@
     class CContext;
     class CContextGroup;
-    class CVariable ;
-    class CVariableGroup ;
-        
-  template <typename T> inline string getStrType(void) ;
-    
-#define macro(T) template <> inline string getStrType<T>(void) { return std::string(#T) ; }
+    class CCalendarWrapper;
+    class CVariable;
+    class CVariableGroup;
+
+  template <typename T> inline string getStrType(void);
+
+#define macro(T) template <> inline string getStrType<T>(void) { return std::string(#T); }
 
   macro(short)
@@ -38,6 +39,6 @@
   macro(bool)
 #undef macro
-  
-#define macro(T) template <> inline string getStrType<T>(void) { return std::string(#T) ; }
+
+#define macro(T) template <> inline string getStrType<T>(void) { return std::string(#T); }
   macro(CDomain)
   macro(CDomainGroup)
@@ -52,10 +53,9 @@
   macro(CContext)
   macro(CContextGroup)
+  macro(CCalendarWrapper)
   macro(CVariable)
   macro(CVariableGroup)
-  
- 
+
 #undef macro
-
 }
 
