From d2e95bc86d1155c87e9435c5beeac7d8d22dc64b Mon Sep 17 00:00:00 2001 From: ArqamFarooqui110719 Date: Fri, 7 Jun 2024 16:45:44 +0530 Subject: [PATCH] updated code as per comment --- src/lib/common/globals.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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; }