From: Tommi Kyntola <tommi.kyntola@gmail.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux-ng@vger.kernel.org
Subject: Re: [RFC/PATCH] week numbers for cal
Date: Wed, 23 Oct 2013 09:56:48 +0300 [thread overview]
Message-ID: <52677330.8070308@gmail.com> (raw)
In-Reply-To: <20131022103214.GG15115@x2.net.home>
On 10/22/13 13:32, Karel Zak wrote:
> On Sat, Oct 05, 2013 at 11:59:54PM +0300, Tommi Kyntola wrote:
>> I keep trying -w with cal from time to time and I finally decided it's
>> about time to do something about it. I'm not sure if this is something
>> you'd be interested in incorporating into util-linux cal, but it's
>> something I wanted, so here it is. There's gcal of course, but I only
>> wanted a toothpick not the whole forest.
>
> Applied, thanks.
>
> Comments:
>
> * please, next time always use space around operators and after
> commas, things like
>
> week_number(xd&~TODAY_FLAG,month+which_cal+1,year,wflag);
>
> are horrible.
Oh, sorry, I thought we might have gone one more iteration cleaning it up
a bit once you were done with the earlier release.
Not that code cleanliness was a design goal at any point and the code seemed
a little stale to begin with. Frankly, I was expecting responses more along
the lines of "that's hardly needed".
Next time, I'll keep it nice even before the RFC.
> * I don't understand this feature:
>
> /* In some years (e.g. 2010 in ISO mode) it's possible to
> * have a remnant of week 53 starting the year yet the year
> * in question ends during 52, in this case we're assuming
> * that early remnant is being referred to if 53 is given
> * as argument. */
>
> For example:
>
> $ LANG=de_DE.UTF8 ./cal --week=53 2009
> Dezember 2009
> Mo Di Mi Do Fr Sa So
> 49 1 2 3 4 5 6
> 50 7 8 9 10 11 12 13
> 51 14 15 16 17 18 19 20
> 52 21 22 23 24 25 26 27
> 53 28 29 30 31
>
> it's correct, let's try the next year:
>
> $ LANG=de_DE.UTF8 ./cal --week=53 2010
> Januar 2010
> Mo Di Mi Do Fr Sa So
> 53 1 2 3
> 1 4 5 6 7 8 9 10
> 2 11 12 13 14 15 16 17
> 3 18 19 20 21 22 23 24
> 4 25 26 27 28 29 30 31
>
> oh... week 53 of the year 2010 in January 2010, but week 52 is December:
>
> $ LANG=de_DE.UTF8 ./cal --week=52 2010
> Dezember 2010
> Mo Di Mi Do Fr Sa So
> 48 1 2 3 4 5
> 49 6 7 8 9 10 11 12
> 50 13 14 15 16 17 18 19
> 51 20 21 22 23 24 25 26
> 52 27 28 29 30 31
>
>
> It seems pretty strange to interpret --week=53 2010 as last week
> of the year 2009. I think it would be more intuitive to interpret
>
> cal --week=53 2010
>
> as invalid week number (or for another years expect this week after
> week 52).
>
> Note that I'm talking about command line --week=53 interpretations, the
> week numbers in the output are correct of course.
That was a tricky one. It did initially fail with invalid argument,
as it does with years that don't have that remnant in January (e.g. 2006),
but to me it seemed stranger to fail with --week=53 when it still shows up
in -y output. These two only differ in highlighting:
cal -my --week 2010
cal -my --week=53 2010
But I certainly understand your point and I think you're right, it probably
makes more sense to follow the numbering definitions and make it only show
up weeks with Thursdays in it (in ISO mode).
One can drop the extra check (when month > 12) and errx straight up to make it
error with 53 when the only part of 53 with present is in January.
cheers,
Tommi Kyntola
prev parent reply other threads:[~2013-10-23 6:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-05 20:59 [RFC/PATCH] week numbers for cal Tommi Kyntola
2013-10-06 15:29 ` Sami Kerola
2013-10-06 17:23 ` Tommi Kyntola
2013-10-06 18:38 ` Benno Schulenberg
2013-10-07 3:10 ` Pádraig Brady
2013-10-07 11:39 ` Tommi Kyntola
2013-10-07 17:06 ` Pádraig Brady
2013-10-07 17:59 ` Tommi Kyntola
2013-10-07 23:33 ` Pádraig Brady
2013-10-09 9:43 ` Karel Zak
2013-10-22 10:32 ` Karel Zak
2013-10-22 15:23 ` Sami Kerola
2013-10-22 15:55 ` Karel Zak
2013-10-23 6:56 ` Tommi Kyntola [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52677330.8070308@gmail.com \
--to=tommi.kyntola@gmail.com \
--cc=kzak@redhat.com \
--cc=util-linux-ng@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox