summaryrefslogtreecommitdiffstats
path: root/misc-utils/cal.c
diff options
context:
space:
mode:
authorKarel Zak2017-11-13 17:34:19 +0100
committerKarel Zak2017-11-13 17:34:19 +0100
commitb9bd8dc267a71611859496bff29e329868273714 (patch)
treefcfbd7e944f9ebd65e4b35cc5a83ec227e1f7bae /misc-utils/cal.c
parentMerge branch '170925' of github.com:jwpi/util-linux (diff)
downloadkernel-qcow2-util-linux-b9bd8dc267a71611859496bff29e329868273714.tar.gz
kernel-qcow2-util-linux-b9bd8dc267a71611859496bff29e329868273714.tar.xz
kernel-qcow2-util-linux-b9bd8dc267a71611859496bff29e329868273714.zip
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 <kzak@redhat.com>
Diffstat (limited to 'misc-utils/cal.c')
-rw-r--r--misc-utils/cal.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 98bdff681..64847da3c 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)