[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5616] Fix defect introduced 20060919T0301Z
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5616] Fix defect introduced 20060919T0301Z |
Date: |
Sat, 08 Dec 2012 11:15:30 +0000 |
Revision: 5616
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5616
Author: chicares
Date: 2012-12-08 11:15:30 +0000 (Sat, 08 Dec 2012)
Log Message:
-----------
Fix defect introduced 20060919T0301Z
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/calendar_date.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2012-12-08 10:49:35 UTC (rev 5615)
+++ lmi/trunk/ChangeLog 2012-12-08 11:15:30 UTC (rev 5616)
@@ -31052,3 +31052,21 @@
oecumenic_enumerations.hpp
Add an enumerator, temporarily leaving a unit-test issue open.
+20121207T0943Z <address@hidden> [555]
+
+ calendar_date_test.cpp
+Augment unit test, demonstrating the issue noted 20121206T1203Z.
+
+20121208T1049Z <address@hidden> [555]
+
+ calendar_date.cpp
+Refactor, adding one local variable and renaming another.
+
+20121208T1115Z <address@hidden> [555]
+
+ calendar_date.cpp
+Fix defect introduced 20060919T0301Z. Given a base date, one of its
+adjacent anniversaries was inappropriately calculated from the other,
+by adding or subtracting one year--causing both anniversaries of a
+leap-year day to fall on March first, even in a leap year.
+
Modified: lmi/trunk/calendar_date.cpp
===================================================================
--- lmi/trunk/calendar_date.cpp 2012-12-08 10:49:35 UTC (rev 5615)
+++ lmi/trunk/calendar_date.cpp 2012-12-08 11:15:30 UTC (rev 5616)
@@ -430,13 +430,13 @@
calendar_date an_adjacent_anniversary = add_years(base_date, offset,
false);
calendar_date last_anniversary =
other_date < an_adjacent_anniversary
- ? add_years(an_adjacent_anniversary, -1, false)
+ ? add_years(base_date, offset - 1, false)
: an_adjacent_anniversary
;
calendar_date next_anniversary =
other_date < an_adjacent_anniversary
? an_adjacent_anniversary
- : add_years(an_adjacent_anniversary, 1, false)
+ : add_years(base_date, offset + 1, false)
;
LMI_ASSERT(last_anniversary <= other_date && other_date <
next_anniversary);
LMI_ASSERT(1 == next_anniversary.year() - last_anniversary.year());
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5616] Fix defect introduced 20060919T0301Z,
Greg Chicares <=