diff options
author | Karel Zak | 2017-12-14 13:19:08 +0100 |
---|---|---|
committer | Karel Zak | 2017-12-14 13:19:08 +0100 |
commit | b9c650106b6db14dd4d162a9f1ff697bd790dc63 (patch) | |
tree | 23866e106fc79e09eb963ea76791bf61950939d6 | |
parent | cal: explain magic values for day of week calculation (diff) | |
download | kernel-qcow2-util-linux-b9c650106b6db14dd4d162a9f1ff697bd790dc63.tar.gz kernel-qcow2-util-linux-b9c650106b6db14dd4d162a9f1ff697bd790dc63.tar.xz kernel-qcow2-util-linux-b9c650106b6db14dd4d162a9f1ff697bd790dc63.zip |
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.
-rw-r--r-- | misc-utils/cal.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c index 70a3d96c4..f56b991dc 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) |