GNU bug report logs - #8930
date +%C

Previous Next

Package: coreutils;

Reported by: Dimitri Tassiaux <d.tassiaux <at> gmail.com>

Date: Fri, 24 Jun 2011 18:51:02 UTC

Severity: normal

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8930 in the body.
You can then email your comments to 8930 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8930; Package coreutils. (Fri, 24 Jun 2011 18:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dimitri Tassiaux <d.tassiaux <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 24 Jun 2011 18:51:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dimitri Tassiaux <d.tassiaux <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: date +%C
Date: Fri, 24 Jun 2011 20:39:41 +0200
[Message part 1 (text/plain, inline)]
~$ *date*
vendredi 24 juin 2011, 20:32:50 (UTC+0200)
~$ *date +%C*
20


*# 21st Century !*



Dimitri Tassiaux


[image: bug date.png]




-- 
Si tu as une pomme, que j'ai une pomme, et que l'on échange nos pommes, nous
aurons chacun une pomme. Mais si tu as une idée, que j'ai une idée et que
l'on échange nos idées, nous aurons chacun deux idées.
George Bernard Shaw (1856-1950)
[Message part 2 (text/html, inline)]
[bug date.png (image/png, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8930; Package coreutils. (Fri, 24 Jun 2011 18:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 8930 <at> debbugs.gnu.org (full text, mbox):

From: Dimitri Tassiaux <d.tassiaux <at> gmail.com>
To: 8930 <at> debbugs.gnu.org
Subject: $date +%C
Date: Fri, 24 Jun 2011 20:57:27 +0200
[Message part 1 (text/plain, inline)]
*Century error !*

date (GNU coreutils) 8.5
Copyright © 2010 Free Software Foundation, Inc.
License GPLv3+ : GNU GPL version 3 ou ultérieure
<http://gnu.org/licenses/gpl.html>
Ceci est logiciel libre, vous êtes libre de le modifier et de le
redistribuer.
Ce logiciel n'est accompagné d'ABSOLUMENT AUCUNE GARANTIE, dans les limites
autorisees par la loi applicable.

Écrit par David MacKenzie.
[Message part 2 (text/html, inline)]

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Fri, 24 Jun 2011 19:53:02 GMT) Full text and rfc822 format available.

Notification sent to Dimitri Tassiaux <d.tassiaux <at> gmail.com>:
bug acknowledged by developer. (Fri, 24 Jun 2011 19:53:02 GMT) Full text and rfc822 format available.

Message #13 received at 8930-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Dimitri Tassiaux <d.tassiaux <at> gmail.com>, 8930-done <at> debbugs.gnu.org
Subject: Re: date +%C
Date: Fri, 24 Jun 2011 13:52:02 -0600
[Message part 1 (text/plain, inline)]
tag 8930 notabug
thanks

> ~$ *date*
> vendredi 24 juin 2011, 20:32:50 (UTC+0200)
> ~$ *date +%C*
> 20
> 
> 
> *# 21st Century !*
> 

Thanks for the report.  However, this is not a bug.

%C does not mean the century in common parlance, rather, according to
POSIX, it means:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html

> 
> %C
>     Century (a year divided by 100 and truncated to an integer) as a decimal number [00,99].

Yes, the mnemonic is using century for lack of a better term, but it is
correctly printing all but the last two digits of the year.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8930; Package coreutils. (Fri, 24 Jun 2011 21:18:01 GMT) Full text and rfc822 format available.

Message #16 received at 8930 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: 8930 <at> debbugs.gnu.org
Subject: Re: bug#8930: date +%C
Date: Fri, 24 Jun 2011 15:16:52 -0600
[Message part 1 (text/plain, inline)]
On 06/24/2011 01:52 PM, Eric Blake wrote:
> %C does not mean the century in common parlance, rather, according to
> POSIX, it means:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html
> 
>>
>> %C
>>     Century (a year divided by 100 and truncated to an integer) as a decimal number [00,99].
> 
> Yes, the mnemonic is using century for lack of a better term, but it is
> correctly printing all but the last two digits of the year.

That said, you found a bug in POSIX.  %C can be larger than 99, since it
maps to the same construct in strftime().

http://austingroupbugs.net/view.php?id=466

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8930; Package coreutils. (Sat, 25 Jun 2011 20:19:02 GMT) Full text and rfc822 format available.

Message #19 received at 8930 <at> debbugs.gnu.org (full text, mbox):

From: James Youngman <jay <at> gnu.org>
To: Dimitri Tassiaux <d.tassiaux <at> gmail.com>
Cc: 8930 <at> debbugs.gnu.org
Subject: Re: bug#8930: $date +%C
Date: Sat, 25 Jun 2011 21:18:18 +0100
2011/6/24 Dimitri Tassiaux <d.tassiaux <at> gmail.com>:
> *Century error !*

This isn't a very intelligible bug report.   When reporting a bug in
software please state as precisely as possible:
1. What you did.
2. What you expected to happen.
3. What actually did happen.

In this case I assume you think that %C prints the century, for
example 21.   It turns out that it doesn't.   From the documentation:
       %C     century; like %Y, except omit last two digits (e.g., 20)

I agree though that using the word "century" here is misleading.

> date (GNU coreutils) 8.5
> Copyright © 2010 Free Software Foundation, Inc.
> License GPLv3+ : GNU GPL version 3 ou ultérieure
> <http://gnu.org/licenses/gpl.html>
> Ceci est logiciel libre, vous êtes libre de le modifier et de le
> redistribuer.
> Ce logiciel n'est accompagné d'ABSOLUMENT AUCUNE GARANTIE, dans les limites
> autorisees par la loi applicable.
>
> Écrit par David MacKenzie.
>




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 24 Jul 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 50 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.