From b9c650106b6db14dd4d162a9f1ff697bd790dc63 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 14 Dec 2017 13:19:08 +0100 Subject: [PATCH] Revert "cal: simplify leap year rule" It was mistake, we use extra rule for date < 1752 from the beginning and another calculations depends on this. This reverts commit b9bd8dc267a71611859496bff29e329868273714. --- misc-utils/cal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 70a3d96c40..f56b991dc1 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -531,9 +531,13 @@ int main(int argc, char **argv) return EXIT_SUCCESS; } +/* leap year -- account for gregorian reformation in 1752 */ static int leap_year(int32_t year) { - return ( !(year % 4) && (year % 100) ) || !(year % 400); + if (year <= REFORMATION_YEAR) + return !(year % 4); + else + return ( !(year % 4) && (year % 100) ) || !(year % 400); } static void init_monthnames(struct cal_control *ctl) -- 2.47.3