bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7866: Problem with date +%s -d


From: Arvizu, Bob (CONT)
Subject: 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:address@hidden 
Sent: Wednesday, January 19, 2011 3:02 PM
To: Arvizu, Bob (CONT)
Cc: address@hidden; 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   address@hidden    +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.









reply via email to

[Prev in Thread] Current Thread [Next in Thread]