From: Karel Zak Date: Mon, 13 Nov 2017 16:34:19 +0000 (+0100) Subject: cal: simplify leap year rule X-Git-Tag: v2.32-rc1~209 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9bd8dc267a71611859496bff29e329868273714;p=thirdparty%2Futil-linux.git cal: simplify leap year rule Gregorian rule for leap years has been adopted by reformation in year 1782 (Calendar Act 1750), but all tools (date, SQL servers, etc. etc.) don't care about it and apply the new rule for all year -- including years before the reformation. It's better to be compatible with another tools than try to be perfect :-) Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1507271 Signed-off-by: Karel Zak --- diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 98bdff6818..64847da3ce 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -531,13 +531,9 @@ int main(int argc, char **argv) return EXIT_SUCCESS; } -/* leap year -- account for gregorian reformation in 1752 */ static int leap_year(int32_t year) { - if (year <= REFORMATION_YEAR) - return !(year % 4); - else - return ( !(year % 4) && (year % 100) ) || !(year % 400); + return ( !(year % 4) && (year % 100) ) || !(year % 400); } static void init_monthnames(struct cal_control *ctl)