GNU bug report logs - #9283
date increment failure for 2011-10-30

Previous Next

Package: coreutils;

Reported by: mike1.lee <at> hsbcib.com

Date: Thu, 11 Aug 2011 16:07: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 9283 in the body.
You can then email your comments to 9283 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#9283; Package coreutils. (Thu, 11 Aug 2011 16:07:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to mike1.lee <at> hsbcib.com:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 11 Aug 2011 16:07:02 GMT) Full text and rfc822 format available.

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

From: mike1.lee <at> hsbcib.com
To: bug-coreutils <at> gnu.org
Subject: date increment failure for 2011-10-30
Date: Thu, 11 Aug 2011 11:52:20 +0100
[Message part 1 (text/plain, inline)]
Here's what I found adding +1 days to a 2011-10-30
(BTW this is not a problem for any other date I tried)


fut=$(date -d"2011-10-30" '+%F') ;
echo $fut
2011-10-30


fut=$(date -d"$fut +1 days" '+%F') ;
echo $fut
2011-10-30


fut=$(date -d"$fut +2 days" '+%F') ;
echo $fut
2011-10-31


Is this reproducable for anyone else ?

uname -a
Linux xxxxxxxxx  2.6.16.60-0.58.1-smp #1 SMP Wed Dec 2 12:27:56 UTC 2009 
x86_64 x86_64 x86_64 GNU/Linux


Regards,
Mike


************************************************************
HSBC Bank plc
Registered Office: 8 Canada Square, London E14 5HQ
Registered in England - Number 14259
Authorised and regulated by the Financial Services Authority
************************************************************


-----------------------------------------
SAVE PAPER - THINK BEFORE YOU PRINT!

This transmission has been issued by a member of the HSBC Group
"HSBC" for the information of the addressee only and should not be
reproduced and/or distributed to any other person. Each page
attached hereto must be read in conjunction with any disclaimer
which forms part of it. Unless otherwise stated, this transmission
is neither an offer nor the solicitation of an offer to sell or
purchase any investment. Its contents are based on information
obtained from sources believed to be reliable but HSBC makes no
representation and accepts no responsibility or liability as to its
completeness or accuracy.
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#9283; Package coreutils. (Thu, 11 Aug 2011 17:10:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: mike1.lee <at> hsbcib.com
Cc: 9283 <at> debbugs.gnu.org
Subject: Re: bug#9283: date increment failure for 2011-10-30
Date: Thu, 11 Aug 2011 10:08:22 -0700
My guess is that, in your time zone, 24 hours after midnight
on 10-30 is indeed 10-31, due to daylight-saving switch.
You can verify this by running 'date' without the '+' option.




Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Thu, 11 Aug 2011 18:03:01 GMT) Full text and rfc822 format available.

Notification sent to mike1.lee <at> hsbcib.com:
bug acknowledged by developer. (Thu, 11 Aug 2011 18:03:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: mike1.lee <at> hsbcib.com
Cc: 9283-done <at> debbugs.gnu.org
Subject: Re: bug#9283: date increment failure for 2011-10-30
Date: Thu, 11 Aug 2011 10:48:38 -0600
tag 9283 notabug
thanks

On 08/11/2011 04:52 AM, mike1.lee <at> hsbcib.com wrote:
> Here's what I found adding +1 days to a 2011-10-30
> (BTW this is not a problem for any other date I tried)

Thanks for the report.  However, this is not a bug, but a consequence of 
daylight savings in your current choice of timezone.  This is a FAQ:

https://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

> fut=$(date -d"2011-10-30" '+%F') ;
> echo $fut
> 2011-10-30
>
>
> fut=$(date -d"$fut +1 days" '+%F') ;
> echo $fut
> 2011-10-30

Adding 24 hours to midnight on a day with 25 hours still results in the 
same day, explaining your results.  The FAQ details several options for 
avoiding the issue, such as fixing your calculations to UTC (which does 
not have daylight savings) or basing your computations relative to noon 
instead of midnight (since both a computed 11am and 1pm still fall in 
the right day, if your relative computation was affected by a daylight 
savings adjustment).

> This transmission has been issued by a member of the HSBC Group

Employer disclaimers cannot be enforced on publicly archived lists; it 
is considered better netiquette to send mail from private email accounts 
that will not append unenforceable text.

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




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

Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Tue, 20 Sep 2011 18:01:02 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 361 days ago.

Previous Next


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