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
This commit is contained in:
@@ -6,17 +6,15 @@
|
|||||||
bool
|
bool
|
||||||
isLeapYear(const int year)
|
isLeapYear(const int year)
|
||||||
{
|
{
|
||||||
if ((year % 400 == 0)||(year % 4 == 0 && year % 100 == 0))
|
int realYear = year + 1900;
|
||||||
return true;
|
return ((realYear % 400 == 0)||(realYear % 4 == 0 && realYear % 100 != 0));
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
getDaysInMonth(const int month, const int year)
|
getDaysInMonth(const int month, const int year)
|
||||||
{
|
{
|
||||||
if (month == 2 && isLeapYear(year)) {
|
if (month == 1 && isLeapYear(year)) {
|
||||||
return 29;
|
return 29;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user