GNU bug report logs -
#10182
Century bug in date utility?
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10182 in the body.
You can then email your comments to 10182 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#10182
; Package
coreutils
.
(Thu, 01 Dec 2011 17:11:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Krzysztof Kowalski <krzysztof7kowalski <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Thu, 01 Dec 2011 17:11:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
We have 2011,
HOWEVER:
korn% date +%C
20
korn% date
Thu Dec 1 16:26:30 CET 2011
apc%
apc% date +%C
20
apc%
apc% date
Thu Dec 1 16:26:51 2011
And many other call returns that we live in 20 century :)
For a test I changed system time to 1997 and date utility returned 20
century as well :)
--
best regards
-- Kowalski Krzysztof
Added tag(s) notabug.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Thu, 01 Dec 2011 17:36:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Thu, 01 Dec 2011 17:36:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Krzysztof Kowalski <krzysztof7kowalski <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 01 Dec 2011 17:36:03 GMT)
Full text and
rfc822 format available.
Message #12 received at 10182-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tag 10182 notabug
thanks
On 12/01/2011 08:34 AM, Krzysztof Kowalski wrote:
> Hello,
>
> We have 2011,
>
> HOWEVER:
>
> korn% date +%C
> 20
> korn% date
> Thu Dec 1 16:26:30 CET 2011
Yep. And this behavior is mandated by POSIX for strftime(), so it is
not a bug.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
C
Replaced by the year divided by 100 and truncated to an integer, as
a decimal number. [ tm_year]
That is, it is NOT the "century" in the vernacular (where years in the
range [2001,2100] are collectively called the 21st century), but the
first two digits of the year. The idea is that you combine %C%y to form %Y.
>
> For a test I changed system time to 1997 and date utility returned 20
> century as well :)
No, %C in 1997 returned 19.
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Message #13 received at 10182-done <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
W dniu 2011-12-01 18:35, Eric Blake pisze:
> tag 10182 notabug
> thanks
>
> On 12/01/2011 08:34 AM, Krzysztof Kowalski wrote:
>>
>
> Yep. And this behavior is mandated by POSIX for strftime(), so it is
> not a bug.
>
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
>
> C
> Replaced by the year divided by 100 and truncated to an integer, as
> a decimal number. [ tm_year]
>
> That is, it is NOT the "century" in the vernacular (where years in the
> range [2001,2100] are collectively called the 21st century), but the
> first two digits of the year. The idea is that you combine %C%y to form %Y.
>
OK, thank you for answer, but it still isn't logical,
century is century by common sense,
if there's 21st century right now 21 should be returned.
- --
best regards
-- Kowalski Krzysztof
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJO18tcAAoJEF58oZESZVTjU7QIAJJGkrll7d9b+NT7AHTYms1V
je2b5GzWD3DA+56QPqBLAOFv2XcnhcrxJIyAr117idsXrbRgxWFOiZTwniJYtjez
Zkc8hWa2YKiljlSVut/XVG1jwEmDG3mYmmmxp6DfkPnF2/1ua3HMpiT9VvKg7Blp
wNTrwdxBPapaFthSDPEKvuWFInx2ogmba17MNaW6zxXh+dWS0Sgh0Qz73ImnftiK
PnSZeNsdiJszyx7etV9YdrsFB7zxpv9OduUArZ2y/XDWDjIBxbMM1hQTLH273Z6L
PhNNMPPvTdFdTckWlO7fOdq5BD3CK4ISnWTiyImpooEt4A+rh0/YgR+o1v6dVWc=
=qtC6
-----END PGP SIGNATURE-----
Message #14 received at 10182-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 12/01/2011 11:45 AM, Krzysztof Kowalski wrote:
>
> OK, thank you for answer, but it still isn't logical,
What's not logical, that %C follows POSIX?
> century is century by common sense,
> if there's 21st century right now 21 should be returned.
Maybe the confusion is coming from the fact that 'date --help' mentions
the word "century" as a mnemonic for %C, even though the POSIX wording
for %C specifically avoids "century" because %C is _not_ a century in
the vernacular usage. Would a patch to the 'date --help' wording
alleviate your concerns? If so, could you propose better wording for
what 'date --help' should say for %C that is still concise and accurate,
but does not mention a misleading mnemonic?
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Message #15 received at 10182-done <at> debbugs.gnu.org (full text, mbox):
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
W dniu 2011-12-01 19:53, Eric Blake pisze:
> On 12/01/2011 11:45 AM, Krzysztof Kowalski wrote:
>>
>> OK, thank you for answer, but it still isn't logical,
>
> What's not logical, that %C follows POSIX?
>
>> century is century by common sense,
>> if there's 21st century right now 21 should be returned.
>
> Maybe the confusion is coming from the fact that 'date --help' mentions
> the word "century" as a mnemonic for %C, even though the POSIX wording
> for %C specifically avoids "century" because %C is _not_ a century in
> the vernacular usage. Would a patch to the 'date --help' wording
> alleviate your concerns? If so, could you propose better wording for
> what 'date --help' should say for %C that is still concise and accurate,
> but does not mention a misleading mnemonic?
>
That would make sense ;),
I can patch it.
- --
best regards
-- Kowalski Krzysztof
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJO181pAAoJEF58oZESZVTjAh8H/2pyl29u/5vAX7Vzez4Bx7+Z
ivHE3zKZN4SHq9ZL2uyZ84HnqnMVJ1EhIS3XQOsQgQqnUriibphgIOvjAWZ1EdnP
hTZ92eqn7XsYhU0O/78doZ3a3Zq/lpR9EMdneqxFFIdbn419UEDu/NXyV2nYx08Y
QcAMaSytBKunItTTPhkveesg8veserIyxfUQ26dJwMLLVv0b6QDCqEOOsspBktkZ
Z5zeHc6IzO7y2lg07CaUhBmdg+gG43dt1lmYH6eJ4cjv/vhQv+IOJzOwJCjvEJ0l
ysZcNkQDgM217GECliYYZl8rf4I14Y8O0tWKyZo8p4N39zoQOg+KlsyohM8+AB8=
=1iJp
-----END PGP SIGNATURE-----
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#10182
; Package
coreutils
.
(Thu, 01 Dec 2011 21:43:01 GMT)
Full text and
rfc822 format available.
Message #18 received at 10182 <at> debbugs.gnu.org (full text, mbox):
Krzysztof Kowalski wrote:
> For a test I changed system time to 1997 and date utility returned 20
> century as well :)
Of course you know you don't need to change the system time to test
this. You can do it easily with date.
$ date -d '1997-01-01 12:00 UTC' +%C
19
Bob
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 30 Dec 2011 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 years and 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.