From 52f8cb492d878d811970b8627ada1b0b00245d4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 3 Apr 2006 21:22:21 +0000 Subject: [PATCH] fixes bug #395 month 0 is January year 0 is 1900 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16992 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/time/DateUtils.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/preferences/time/DateUtils.cpp b/src/preferences/time/DateUtils.cpp index 661a25bc6d..9c95e016fa 100644 --- a/src/preferences/time/DateUtils.cpp +++ b/src/preferences/time/DateUtils.cpp @@ -6,17 +6,15 @@ bool isLeapYear(const int year) { - if ((year % 400 == 0)||(year % 4 == 0 && year % 100 == 0)) - return true; - else - return false; + int realYear = year + 1900; + return ((realYear % 400 == 0)||(realYear % 4 == 0 && realYear % 100 != 0)); } int getDaysInMonth(const int month, const int year) { - if (month == 2 && isLeapYear(year)) { + if (month == 1 && isLeapYear(year)) { return 29; }