diff options
author | J William Piggott | 2018-01-22 13:01:23 +0100 |
---|---|---|
committer | Karel Zak | 2018-01-22 14:16:57 +0100 |
commit | e572a765f9e2a9ff33677bbf5d01644c3c024327 (patch) | |
tree | 6365b19abaf0fb41d9c44972be4b823f05d30d85 /misc-utils/cal.c | |
parent | Merge branch 'patch-2' of https://github.com/sourcejedi/util-linux (diff) | |
download | kernel-qcow2-util-linux-e572a765f9e2a9ff33677bbf5d01644c3c024327.tar.gz kernel-qcow2-util-linux-e572a765f9e2a9ff33677bbf5d01644c3c024327.tar.xz kernel-qcow2-util-linux-e572a765f9e2a9ff33677bbf5d01644c3c024327.zip |
cal: fix week calculations for 1752
Before:
cal --week=39 1752
September 1752
Su Mo Tu We Th Fr Sa
36 1 2 14 15 16
37 17 18 19 20 21 22 23
38 24 25 26 27 28 29 30
Patched:
cal --week=39 1752
October 1752
Su Mo Tu We Th Fr Sa
39 1 2 3 4 5 6 7
40 8 9 10 11 12 13 14
41 15 16 17 18 19 20 21
42 22 23 24 25 26 27 28
43 29 30 31
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'misc-utils/cal.c')
-rw-r--r-- | misc-utils/cal.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c index c2e2913e7..894894ab6 100644 --- a/misc-utils/cal.c +++ b/misc-utils/cal.c @@ -997,6 +997,9 @@ static int week_to_day(const struct cal_control *ctl) wday = day_in_week(ctl, 1, JANUARY, ctl->req.year); yday = ctl->req.week * DAYS_IN_WEEK - wday; + if (ctl->req.year == ctl->reform_year && yday >= YDAY_AFTER_MISSING) + yday += NUMBER_MISSING_DAYS; + if (ctl->weektype & WEEK_NUM_ISO) yday -= (wday >= FRIDAY ? -2 : 5); else |