GNU bug report logs - #10182
Century bug in date utility?

Previous Next

Package: coreutils;

Reported by: Krzysztof Kowalski <krzysztof7kowalski <at> gmail.com>

Date: Thu, 1 Dec 2011 17:11:01 UTC

Severity: normal

Tags: notabug

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Krzysztof Kowalski <krzysztof7kowalski <at> gmail.com>
Subject: bug#10182: closed (Re: bug#10182: Century bug in date utility?)
Date: Thu, 01 Dec 2011 17:36:03 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#10182: Century bug in date utility?

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 10182 <at> debbugs.gnu.org.

-- 
10182: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10182
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eric Blake <eblake <at> redhat.com>
To: Krzysztof Kowalski <krzysztof7kowalski <at> gmail.com>
Cc: 10182-done <at> debbugs.gnu.org
Subject: Re: bug#10182: Century bug in date utility?
Date: Thu, 01 Dec 2011 10:35:31 -0700
[Message part 3 (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 part 5 (message/rfc822, inline)]
From: Krzysztof Kowalski <krzysztof7kowalski <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Century bug in date utility?
Date: Thu, 01 Dec 2011 16:34:09 +0100
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




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.