Ignore:
Timestamp:
09/06/11 16:45:08 (13 years ago)
Author:
hozdoba
Message:

Corrections après tests sur titane

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/common/src/xmlio/calendar_util.cpp

    r219 r266  
    3737      { 
    3838         CDuration dur(ddr); 
    39          dur.year = -dur.year;  dur.month  = -dur.month ; dur.day    = -dur.day; 
    40          dur.hour = -dur.hour;  dur.minute = -dur.minute; dur.second = -dur.second; 
     39         dur.year   = -dur.year; 
     40         dur.month  = -dur.month; 
     41         dur.day    = -dur.day; 
     42         dur.hour   = -dur.hour; 
     43         dur.minute = -dur.minute; 
     44         dur.second = -dur.second; 
    4145         return (dur); 
    4246      } 
     
    6872 
    6973         // Ajustement des mois en fonction des jours. 
    70          int signVal = drr.day/fabs(drr.day); 
     74         int signVal = (drr.day != 0) ? drr.day/fabs(drr.day) : 0; 
    7175         CDate dtt(dt); dtt.addMonth (signVal); 
    7276 
     
    7781         if (day <  0) { drr.month --; day += c.getMonthLength(dtt); } 
    7882         if (day >= c.getMonthLength(dtt)) { drr.month ++; day -= c.getMonthLength(dtt); } // << ProblÚme ici 
    79          if (day == 0) day = c.getMonthLength(dtt); 
    80  
     83         if (day == 0){ day = c.getMonthLength(dtt); drr.month --; } 
     84          
    8185         drr.resolve(dt.getRelCalendar()); 
    8286 
    8387         // Ajustement des années en fonction des mois. 
    8488         month += dt.getMonth() + drr.month; 
    85          if (month <  0) { year --; month += c.getYearLength(); } 
    86          if (month >= c.getYearLength()) { year ++; month -= c.getYearLength(); } 
    87          if (month == 0) month = c.getYearLength(); 
     89         if (month <  0) { drr.year --; month += c.getYearLength(); } 
     90         if (month >  c.getYearLength()) { drr.year ++; month -= c.getYearLength(); } 
     91         if (month == 0){ month = c.getYearLength(); drr.year--; } 
    8892 
    8993         year += dt.getYear() + drr.year; 
     
    118122      { 
    119123         // TODO :: Vérifier que les deux dates (dt0 et dt1) ont une référence vers le même calendrier. 
    120          if (dt0.getYear()   < dt1.getYear())   return true; if (dt0.getMonth()  < dt1.getMonth())  return true; 
    121          if (dt0.getDay()    < dt1.getDay())    return true; if (dt0.getHour()   < dt1.getHour())   return true; 
    122          if (dt0.getMinute() < dt1.getMinute()) return true; if (dt0.getSecond() < dt1.getSecond()) return true; 
     124         if   (dt0.getYear()  < dt1.getYear()) 
     125         {  
     126            return true; 
     127         } 
     128         else if (dt0.getYear() == dt1.getYear()) 
     129         {  
     130            if   (dt0.getMonth()  < dt1.getMonth()) 
     131            { 
     132               return true; 
     133            } 
     134            else if (dt0.getMonth() == dt1.getMonth()) 
     135            { 
     136               if   (dt0.getDay()  < dt1.getDay()) 
     137               { 
     138                   return true; 
     139               } 
     140               else if (dt0.getDay() == dt1.getDay()) 
     141               { 
     142                  if    (dt0.getHour()  < dt1.getHour()) 
     143                  { 
     144                     return true; 
     145                  } 
     146                  else if (dt0.getHour() == dt1.getHour()) 
     147                  {  
     148                     if   (dt0.getMinute()  < dt1.getMinute()) 
     149                     { 
     150                        return true; 
     151                     } 
     152                     else if (dt0.getMinute() == dt1.getMinute()) 
     153                     { 
     154                        if (dt0.getSecond() < dt1.getSecond()) 
     155                           return true; 
     156                     } 
     157                  } 
     158               } 
     159            } 
     160         } 
    123161         return false; 
    124162      } 
Note: See TracChangeset for help on using the changeset viewer.