GNU bug report logs - #7866
Problem with date +%s -d

Previous Next

Package: coreutils;

Reported by: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>

Date: Wed, 19 Jan 2011 18:45:02 UTC

Severity: normal

Done: Bob Proulx <bob <at> proulx.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 7866 in the body.
You can then email your comments to 7866 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#7866; Package coreutils. (Wed, 19 Jan 2011 18:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Wed, 19 Jan 2011 18:45:02 GMT) Full text and rfc822 format available.

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

From: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>, "Sheth,
	Amit \(CONT\)" <Amit.Sheth <at> capitalone.com>
Subject: Problem with date +%s -d 
Date: Wed, 19 Jan 2011 13:51:13 -0500
[Message part 1 (text/plain, inline)]
Folks,

fyi ...
I've discovered a problem with the "date +%s -d Date" command on
Linux xxxxxx 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 2010 i686 i686 i386 GNU/Linux
and
Linux yyyyyy 2.6.9-89.0.28.ELlargesmp #1 SMP Thu Jul 22 18:24:58 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

date +%s -d 20110313
1299992400
date +%s -d 20110314
1300075200
echo $(( 1300075200 - 1299992400 ))
82800


Regards,
Bob Arvizu

</pre>






The information contained in this e-mail is confidential and/or proprietary 
<br>
to Capital One and/or its affiliates. The information transmitted herewith
<br>
is intended only for use by the individual or entity to which it is 
<br>
addressed.  If the reader of this message is not the intended recipient, 
<br>
you are hereby notified that any review, retransmission, dissemination, 
<br>
distribution, copying or other use of, or taking of any action in reliance 
<br>
upon this information is strictly prohibited. If you have received this 
<br>
communication in error, please contact the sender and delete the material 
<br>
from your computer.
<br>


</pre>
[Message part 2 (text/html, inline)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7866; Package coreutils. (Wed, 19 Jan 2011 19:54:02 GMT) Full text and rfc822 format available.

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

From: Eric Blake <eblake <at> redhat.com>
To: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>, 7866 <at> debbugs.gnu.org, "Sheth,
	Amit \(CONT\)" <Amit.Sheth <at> capitalone.com>
Subject: Re: bug#7866: Problem with date +%s -d
Date: Wed, 19 Jan 2011 13:01:38 -0700
[Message part 1 (text/plain, inline)]
On 01/19/2011 11:51 AM, Arvizu, Bob (CONT) wrote:
> Folks,
> 
> fyi ...
> I've discovered a problem with the "date +%s -d Date" command on
> Linux xxxxxx 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 2010 i686 i686 i386 GNU/Linux
> and
> Linux yyyyyy 2.6.9-89.0.28.ELlargesmp #1 SMP Thu Jul 22 18:24:58 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
> 
> date +%s -d 20110313
> 1299992400
> date +%s -d 20110314
> 1300075200
> echo $(( 1300075200 - 1299992400 ))
> 82800

You haven't stated what the problem is that you found, though.  I'm
afraid I don't see any bug in what you posted.

My guess is that you are complaining that the difference is one of 23
hours instead of the usual 24, but that's expected according to your TZ
settings, when you cross a daylight savings boundary.

If you want your calculations to be independent of daylight savings
issues, then force the time zone:

$ date +%s -d 20110313 -u
1299974400
$ date +%s -d 20110314 -u
1300060800
$ echo $(( 1300060800 - 1299974400 ))
86400

See also the FAQ:
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

> The information contained in this e-mail is confidential and/or proprietary 

It is considered poor netiquette to send mail with such disclaimers to
publicly archived lists, where the disclaimer is unenforceable.  You may
have better luck using a personal account for sending bug report emails
if you can't avoid your employer's disclaimer.

-- 
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#7866; Package coreutils. (Wed, 19 Jan 2011 20:05:02 GMT) Full text and rfc822 format available.

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

From: "Gilles Espinasse" <g.esp <at> free.fr>
To: <7866 <at> debbugs.gnu.org>, "Arvizu, Bob \(CONT\)" <Bob.Arvizu <at> capitalone.com>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>, "Sheth,
	Amit \(CONT\)" <Amit.Sheth <at> capitalone.com>
Subject: Re: bug#7866: Problem with date +%s -d 
Date: Wed, 19 Jan 2011 21:08:58 +0100
----- Original Message ----- 
From: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
To: <7866 <at> debbugs.gnu.org>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>; "Sheth,Amit (CONT)"
<Amit.Sheth <at> capitalone.com>
Sent: Wednesday, January 19, 2011 7:51 PM
Subject: bug#7866: Problem with date +%s -d


> Folks,
>
> fyi ...
> I've discovered a problem with the "date +%s -d Date" command on
> Linux xxxxxx 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 2010
>  i686 i686 i386 GNU/Linux
> and
> Linux yyyyyy 2.6.9-89.0.28.ELlargesmp #1 SMP Thu Jul 22 18:24:58 EDT 2010
> x86_64 x86_64 x86_64 GNU/Linux
>
> date +%s -d 20110313
> 1299992400
> date +%s -d 20110314
> 1300075200
> echo $(( 1300075200 - 1299992400 ))
> 82800
>
>
Thank for the report.
This is addressed in FAQ
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

this should show the timezone names switching time the 13 March :
cd /usr/share/zoneinfo/posix && find ./ -type f -exec zdump -v {} \; | grep
'2011' | grep 'Mar 13'

Gilles
</pre>






The information contained in this e-mail is confidential and/or proprietary
<br>
to Capital One and/or its affiliates. The information transmitted herewith
<br>
is intended only for use by the individual or entity to which it is
<br>
addressed.  If the reader of this message is not the intended recipient,
<br>
you are hereby notified that any review, retransmission, dissemination,
<br>
distribution, copying or other use of, or taking of any action in reliance
<br>
upon this information is strictly prohibited. If you have received this
<br>
communication in error, please contact the sender and delete the material
<br>
from your computer.
<br>


</pre>





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

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

From: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
To: Eric Blake <eblake <at> redhat.com>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>,
	"7866 <at> debbugs.gnu.org" <7866 <at> debbugs.gnu.org>, "Sheth,
	Amit \(CONT\)" <Amit.Sheth <at> capitalone.com>
Subject: RE: bug#7866: Problem with date +%s -d
Date: Wed, 19 Jan 2011 15:13:02 -0500
Thanks, Eric!!  That's it!!
I didn't daylight savings boundary!!

Thanks,
Bob

-----Original Message-----
From: Eric Blake [mailto:eblake <at> redhat.com] 
Sent: Wednesday, January 19, 2011 3:02 PM
To: Arvizu, Bob (CONT)
Cc: 7866 <at> debbugs.gnu.org; Barrar, John; Sheth, Amit (CONT)
Subject: Re: bug#7866: Problem with date +%s -d

On 01/19/2011 11:51 AM, Arvizu, Bob (CONT) wrote:
> Folks,
> 
> fyi ...
> I've discovered a problem with the "date +%s -d Date" command on Linux 
> xxxxxx 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 2010 i686 
> i686 i386 GNU/Linux and Linux yyyyyy 2.6.9-89.0.28.ELlargesmp #1 SMP 
> Thu Jul 22 18:24:58 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
> 
> date +%s -d 20110313
> 1299992400
> date +%s -d 20110314
> 1300075200
> echo $(( 1300075200 - 1299992400 ))
> 82800

You haven't stated what the problem is that you found, though.  I'm afraid I don't see any bug in what you posted.

My guess is that you are complaining that the difference is one of 23 hours instead of the usual 24, but that's expected according to your TZ settings, when you cross a daylight savings boundary.

If you want your calculations to be independent of daylight savings issues, then force the time zone:

$ date +%s -d 20110313 -u
1299974400
$ date +%s -d 20110314 -u
1300060800
$ echo $(( 1300060800 - 1299974400 ))
86400

See also the FAQ:
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

> The information contained in this e-mail is confidential and/or 
> proprietary

It is considered poor netiquette to send mail with such disclaimers to publicly archived lists, where the disclaimer is unenforceable.  You may have better luck using a personal account for sending bug report emails if you can't avoid your employer's disclaimer.

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








The information contained in this e-mail is confidential and/or proprietary

to Capital One and/or its affiliates. The information transmitted herewith

is intended only for use by the individual or entity to which it is 

addressed.  If the reader of this message is not the intended recipient, 

you are hereby notified that any review, retransmission, dissemination, 

distribution, copying or other use of, or taking of any action in reliance 

upon this information is strictly prohibited. If you have received this 

communication in error, please contact the sender and delete the material 

from your computer.








Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#7866; Package coreutils. (Wed, 19 Jan 2011 20:07:01 GMT) Full text and rfc822 format available.

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

From: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
To: Gilles Espinasse <g.esp <at> free.fr>, "7866 <at> debbugs.gnu.org"
	<7866 <at> debbugs.gnu.org>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>, "Sheth,
	Amit \(CONT\)" <Amit.Sheth <at> capitalone.com>
Subject: RE: bug#7866: Problem with date +%s -d 
Date: Wed, 19 Jan 2011 15:14:20 -0500
Thanks, Gilles!!

Daylight savings didn't occur to me!!  
That's great, because that means there's no bug!!

Thanks!!!!
-Bob

-----Original Message-----
From: Gilles Espinasse [mailto:g.esp <at> free.fr] 
Sent: Wednesday, January 19, 2011 3:09 PM
To: 7866 <at> debbugs.gnu.org; Arvizu, Bob (CONT)
Cc: Barrar, John; Sheth, Amit (CONT)
Subject: Re: bug#7866: Problem with date +%s -d 


----- Original Message ----- 
From: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
To: <7866 <at> debbugs.gnu.org>
Cc: "Barrar, John" <john.barrar <at> capitalone.com>; "Sheth,Amit (CONT)"
<Amit.Sheth <at> capitalone.com>
Sent: Wednesday, January 19, 2011 7:51 PM
Subject: bug#7866: Problem with date +%s -d


> Folks,
>
> fyi ...
> I've discovered a problem with the "date +%s -d Date" command on
> Linux xxxxxx 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 17:56:21 EST 2010
>  i686 i686 i386 GNU/Linux
> and
> Linux yyyyyy 2.6.9-89.0.28.ELlargesmp #1 SMP Thu Jul 22 18:24:58 EDT 2010
> x86_64 x86_64 x86_64 GNU/Linux
>
> date +%s -d 20110313
> 1299992400
> date +%s -d 20110314
> 1300075200
> echo $(( 1300075200 - 1299992400 ))
> 82800
>
>
Thank for the report.
This is addressed in FAQ
http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e

this should show the timezone names switching time the 13 March :
cd /usr/share/zoneinfo/posix && find ./ -type f -exec zdump -v {} \; | grep
'2011' | grep 'Mar 13'

Gilles
</pre>






The information contained in this e-mail is confidential and/or proprietary
<br>
to Capital One and/or its affiliates. The information transmitted herewith
<br>
is intended only for use by the individual or entity to which it is
<br>
addressed.  If the reader of this message is not the intended recipient,
<br>
you are hereby notified that any review, retransmission, dissemination,
<br>
distribution, copying or other use of, or taking of any action in reliance
<br>
upon this information is strictly prohibited. If you have received this
<br>
communication in error, please contact the sender and delete the material
<br>
from your computer.
<br>


</pre>








The information contained in this e-mail is confidential and/or proprietary

to Capital One and/or its affiliates. The information transmitted herewith

is intended only for use by the individual or entity to which it is 

addressed.  If the reader of this message is not the intended recipient, 

you are hereby notified that any review, retransmission, dissemination, 

distribution, copying or other use of, or taking of any action in reliance 

upon this information is strictly prohibited. If you have received this 

communication in error, please contact the sender and delete the material 

from your computer.








Reply sent to Bob Proulx <bob <at> proulx.com>:
You have taken responsibility. (Wed, 19 Jan 2011 20:32:02 GMT) Full text and rfc822 format available.

Notification sent to "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>:
bug acknowledged by developer. (Wed, 19 Jan 2011 20:32:02 GMT) Full text and rfc822 format available.

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

From: Bob Proulx <bob <at> proulx.com>
To: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
Cc: 7866-done <at> debbugs.gnu.org
Subject: Re: bug#7866: Problem with date +%s -d
Date: Wed, 19 Jan 2011 13:39:13 -0700
Arvizu, Bob (CONT) wrote:
> That's great, because that means there's no bug!!

Closing this bug ticket with this message.

Bob




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

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

From: "Arvizu, Bob (CONT)" <Bob.Arvizu <at> capitalone.com>
To: "7866 <at> debbugs.gnu.org" <7866 <at> debbugs.gnu.org>
Subject: RE: bug#7866: closed (Re: bug#7866: Problem with date +%s -d)
Date: Wed, 19 Jan 2011 15:57:08 -0500
Thanks very much for the update!!
Congratulations!!  You're all impressively responsive .... and, just plain Darn GOOD!!
:-)
Bob Arvizu

-----Original Message-----
From: GNU bug Tracking System [mailto:help-debbugs <at> gnu.org] 
Sent: Wednesday, January 19, 2011 3:32 PM
To: Arvizu, Bob (CONT)
Subject: bug#7866: closed (Re: bug#7866: Problem with date +%s -d)

Your bug report

#7866: Problem with date +%s -d 

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 7866 <at> debbugs.gnu.org.

-- 
7866: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7866
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems







The information contained in this e-mail is confidential and/or proprietary

to Capital One and/or its affiliates. The information transmitted herewith

is intended only for use by the individual or entity to which it is 

addressed.  If the reader of this message is not the intended recipient, 

you are hereby notified that any review, retransmission, dissemination, 

distribution, copying or other use of, or taking of any action in reliance 

upon this information is strictly prohibited. If you have received this 

communication in error, please contact the sender and delete the material 

from your computer.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 17 Feb 2011 12:24:05 GMT) Full text and rfc822 format available.

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

Previous Next


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