* Wrong unit test and algorithm for leapyears (year 1900)
This commit is contained in:
12
src/Date.cpp
12
src/Date.cpp
@@ -303,9 +303,15 @@ bool Date::leapYear (int year)
|
||||
{
|
||||
bool ly = false;
|
||||
|
||||
if (!(year % 4)) ly = true;
|
||||
else if (!(year % 400)) ly = true;
|
||||
else if (!(year % 100)) ly = false;
|
||||
if (!(year % 4))
|
||||
{
|
||||
ly = true;
|
||||
if (!(year % 100))
|
||||
{
|
||||
ly = false;
|
||||
if (!(year % 400)) ly =true;
|
||||
}
|
||||
}
|
||||
|
||||
return ly;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user