summaryrefslogtreecommitdiffstats
path: root/misc-utils/cal.c
diff options
context:
space:
mode:
authorJ William Piggott2018-01-22 13:03:27 +0100
committerKarel Zak2018-01-22 14:16:57 +0100
commit6304358cb79f628ce13ec51964db176c0c083429 (patch)
treecb40d2617fcd300a273c04358c0422850caf81c4 /misc-utils/cal.c
parentcal: fix week calculations for 1752 (diff)
downloadkernel-qcow2-util-linux-6304358cb79f628ce13ec51964db176c0c083429.tar.gz
kernel-qcow2-util-linux-6304358cb79f628ce13ec51964db176c0c083429.tar.xz
kernel-qcow2-util-linux-6304358cb79f628ce13ec51964db176c0c083429.zip
cal: fix first week calculation
Commit efafeaf set 1 Jan as week 1, but the change was missed in week_to_day() and in the man page. Before cal --week=40 --iso 1752 October 1752 Su Mo Tu We Th Fr Sa 41 1 2 3 4 5 6 7 42 8 9 10 11 12 13 14 43 15 16 17 18 19 20 21 44 22 23 24 25 26 27 28 45 29 30 31 Patched cal --week=40 --iso 1752 September 1752 Su Mo Tu We Th Fr Sa 36 1 2 37 3 4 5 6 7 8 9 38 10 11 12 13 14 15 16 39 17 18 19 20 21 22 23 40 24 25 26 27 28 29 30 Signed-off-by: J William Piggott <elseifthen@gmx.com>
Diffstat (limited to 'misc-utils/cal.c')
-rw-r--r--misc-utils/cal.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/misc-utils/cal.c b/misc-utils/cal.c
index 894894ab6..438e7f09b 100644
--- a/misc-utils/cal.c
+++ b/misc-utils/cal.c
@@ -1003,7 +1003,7 @@ static int week_to_day(const struct cal_control *ctl)
if (ctl->weektype & WEEK_NUM_ISO)
yday -= (wday >= FRIDAY ? -2 : 5);
else
- yday -= (wday == SUNDAY ? 6 : -1); /* WEEK_NUM_US */
+ yday -= 6; /* WEEK_NUM_US */
if (yday <= 0)
return 1;