[PATCH] Correctly calculate leap year.

Kohei Yoshida kohei.yoshida at suse.com
Tue Feb 28 19:01:52 PST 2012


With the old code, year 2000 would not be a leap year, but it actually
is.  With this, Calc correctly loads cell with date value of 2000-2-29.
---
 sax/source/tools/converter.cxx |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index eb8cc74..95f6494 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -1304,7 +1304,7 @@ readDateTimeComponent(const ::rtl::OUString & rString,
 static bool lcl_isLeapYear(const sal_uInt32 nYear)
 {
     return ((nYear % 4) == 0)
-        && !(((nYear % 100) == 0) || ((nYear % 400) == 0));
+        && (((nYear % 100) != 0) || ((nYear % 400) == 0));
 }
 
 static sal_uInt16
-- 
1.7.3.4


--=-pmPG8nzdmWV98WJbVpPr--



More information about the LibreOffice mailing list