public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Tommi Kyntola <tommi.kyntola@gmail.com>
Cc: util-linux-ng@vger.kernel.org
Subject: Re: [RFC/PATCH] week numbers for cal
Date: Tue, 22 Oct 2013 12:32:14 +0200	[thread overview]
Message-ID: <20131022103214.GG15115@x2.net.home> (raw)
In-Reply-To: <CAO2cUkTj+f+6xrgr6+WzY9D+TwwZHWYhMfuMKKYF=39vJ8wU6w@mail.gmail.com>

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.

* 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.

    Karel
    

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  parent reply	other threads:[~2013-10-22 10:32 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 [this message]
2013-10-22 15:23   ` Sami Kerola
2013-10-22 15:55     ` Karel Zak
2013-10-23  6:56   ` Tommi Kyntola

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=20131022103214.GG15115@x2.net.home \
    --to=kzak@redhat.com \
    --cc=tommi.kyntola@gmail.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