Skip to content

Commit

Permalink
updated code as per comment
Browse files Browse the repository at this point in the history
  • Loading branch information
ArqamFarooqui110719 committed Jun 7, 2024
1 parent d9e3175 commit d2e95bc
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/lib/common/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,15 +543,16 @@ static int timezoneOffset(const char* tz)
*/
bool isLeapYear(int year)
{
if (year % 4 != 0)
// ref: https://www.geeksforgeeks.org/program-check-given-year-leap-year/
if (year % 400 == 0)
{
return false;
return true;
}
if (year % 100 == 0 && year % 400 != 0)
if ((year % 4 == 0) && (year % 100 != 0))
{
return false;
return true;
}
return true;
return false;
}


Expand Down

0 comments on commit d2e95bc

Please sign in to comment.