Changeset 266 for XMLIO_V2/dev/common/src/xmlio/calendar_util.cpp
- Timestamp:
- 09/06/11 16:45:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/common/src/xmlio/calendar_util.cpp
r219 r266 37 37 { 38 38 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; 41 45 return (dur); 42 46 } … … 68 72 69 73 // 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; 71 75 CDate dtt(dt); dtt.addMonth (signVal); 72 76 … … 77 81 if (day < 0) { drr.month --; day += c.getMonthLength(dtt); } 78 82 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 81 85 drr.resolve(dt.getRelCalendar()); 82 86 83 87 // Ajustement des années en fonction des mois. 84 88 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--; } 88 92 89 93 year += dt.getYear() + drr.year; … … 118 122 { 119 123 // 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 } 123 161 return false; 124 162 }
Note: See TracChangeset
for help on using the changeset viewer.