diff --git a/src/lib/common/globals.cpp b/src/lib/common/globals.cpp index 3bdbb39a93..2bc490b004 100644 --- a/src/lib/common/globals.cpp +++ b/src/lib/common/globals.cpp @@ -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; }