GNU bug report logs -
#11098
date --yesterday wrong result
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 11098 in the body.
You can then email your comments to 11098 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#11098
; Package
coreutils
.
(Mon, 26 Mar 2012 16:43:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Hugo Guérineau <hugo.guerineau <at> wwsight.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Mon, 26 Mar 2012 16:43:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Dear Mister, Madam,
I'm writing to report a date computation problem.
The command "date --date='yesterday' +%Y-%m-%d" launched this morning
between 0:00 am and 0:59 am gives the wrong result:
root <at> serveur:> date --date='today' +%Y-%m-%d; date --date='yesterday'
+%Y-%m-%d
2012-03-26
2012-03-24
This is caused by the system clock changes which happened last night. If we
run the command with full date display format, we can see that UTC+0100
have switch to UTC+0200:
root <at> serveur:> date --date='today'; date --date='yesterday'
lundi 26 mars 2012, 00:27:43 (UTC+0200)
samedi 24 mars 2012, 23:27:43 (UTC+0100)
Without any reference to UTC, "yesterday" means "the day before" and not
"now minus 24 hours". That's the reason why results are good in the full
display format and wrong when we are only displaying the day.
I hope this report will be usefull and want to thank you for any feedback
you could give me about it.
Yours faithfully,
Hugo Guérineau
Expert Génie Logiciel
tel: 06.50.88.43.47
hugo.guerineau <at> wwsight.com
[Message part 2 (text/html, inline)]
Added tag(s) notabug.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Mon, 26 Mar 2012 18:04:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Eric Blake <eblake <at> redhat.com>
:
You have taken responsibility.
(Mon, 26 Mar 2012 18:04:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Hugo Guérineau <hugo.guerineau <at> wwsight.com>
:
bug acknowledged by developer.
(Mon, 26 Mar 2012 18:04:03 GMT)
Full text and
rfc822 format available.
Message #12 received at 11098-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
tag 11098 notabug
thanks
On 03/26/2012 05:31 AM, Hugo Guérineau wrote:
> Dear Mister, Madam,
>
> I'm writing to report a date computation problem.
>
> The command "date --date='yesterday' +%Y-%m-%d" launched this morning
> between 0:00 am and 0:59 am gives the wrong result:
>
> root <at> serveur:> date --date='today' +%Y-%m-%d; date --date='yesterday'
> +%Y-%m-%d
> 2012-03-26
> 2012-03-24
>
> This is caused by the system clock changes which happened last night.
Thanks for the report. However, this is not a bug in date, but in your
expectations. 'yesterday' translates to '24 hours ago', and due to your
daylight savings swap, 24 hours ago really does put you into a different
date. As recommended in our FAQ,
https://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
it's almost always better to base relative time computations off of noon
rather than midnight (as both 11 am and 1 pm fall in the same day, even
when your multiple-of-24-hours crosses a 23-hour or 25-hour day).
--
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 11098-done <at> debbugs.gnu.org (full text, mbox):
Hi Eric,
Thank you for this answer. My excpectations are not buged! ;) When
someone ask me to tell him what is yesterday, even if we are early in
the morning, I answer him the day before and not two days ago.
I already know how to work around this problem. Anyway, I'd like to
thank you for the link to you're FAQ and for your quick answer.
Best regards,
Hugo
Le 26 mars 2012 à 19:31, Eric Blake <eblake <at> redhat.com> a écrit :
> tag 11098 notabug
> thanks
>
> On 03/26/2012 05:31 AM, Hugo Guérineau wrote:
>> Dear Mister, Madam,
>>
>> I'm writing to report a date computation problem.
>>
>> The command "date --date='yesterday' +%Y-%m-%d" launched this morning
>> between 0:00 am and 0:59 am gives the wrong result:
>>
>> root <at> serveur:> date --date='today' +%Y-%m-%d; date --date='yesterday'
>> +%Y-%m-%d
>> 2012-03-26
>> 2012-03-24
>>
>> This is caused by the system clock changes which happened last night.
>
> Thanks for the report. However, this is not a bug in date, but in your
> expectations. 'yesterday' translates to '24 hours ago', and due to your
> daylight savings swap, 24 hours ago really does put you into a different
> date. As recommended in our FAQ,
>
> https://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e
>
> it's almost always better to base relative time computations off of noon
> rather than midnight (as both 11 am and 1 pm fall in the same day, even
> when your multiple-of-24-hours crosses a 23-hour or 25-hour day).
>
> --
> Eric Blake eblake <at> redhat.com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
Forcibly Merged 11098 11101.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Tue, 27 Mar 2012 17:14:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 11098-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 03/27/2012 03:15 AM, Hugo Guérineau wrote:
> Hi Eric,
>
> Thank you for this answer. My excpectations are not buged! ;) When
> someone ask me to tell him what is yesterday, even if we are early in
> the morning, I answer him the day before and not two days ago.
You are welcome to submit a patch to gnulib to change getdate.y, and to
coreutils to document your desired improved semantic change to relative
date computations. It's just that it is such a complex patch, and the
fact that we have a documented workaround, that no one has been bothered
enough to submit a patch so far.
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
Forcibly Merged 11098 11101 11125.
Request was from
Eric Blake <eblake <at> redhat.com>
to
control <at> debbugs.gnu.org
.
(Thu, 29 Mar 2012 18:34:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 11098-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Eric,
Thanks for your candor. I will download the source code as soon as I will
have some time to work on it. I really don't know the process to submit a
patch. Could you send me a read access to the latest release on you're
repository?
rgds,
Hugo
Le 27 mars 2012 19:38, Eric Blake <eblake <at> redhat.com> a écrit :
> On 03/27/2012 03:15 AM, Hugo Guérineau wrote:
> > Hi Eric,
> >
> > Thank you for this answer. My excpectations are not buged! ;) When
> > someone ask me to tell him what is yesterday, even if we are early in
> > the morning, I answer him the day before and not two days ago.
>
> You are welcome to submit a patch to gnulib to change getdate.y, and to
> coreutils to document your desired improved semantic change to relative
> date computations. It's just that it is such a complex patch, and the
> fact that we have a documented workaround, that no one has been bothered
> enough to submit a patch so far.
>
> --
> Eric Blake eblake <at> redhat.com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
[Message part 2 (text/html, inline)]
Message #20 received at 11098-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
[please don't top-post on technical lists]
On 04/03/2012 10:17 AM, Hugo Guérineau wrote:
> Hi Eric,
>
> Thanks for your candor. I will download the source code as soon as I will
> have some time to work on it. I really don't know the process to submit a
> patch. Could you send me a read access to the latest release on you're
> repository?
Here's a pointer to coreutils' HACKING policies:
http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING
--
Eric Blake eblake <at> redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[signature.asc (application/pgp-signature, attachment)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 02 May 2012 11:24:02 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Pádraig Brady <P <at> draigBrady.com>
to
control <at> debbugs.gnu.org
.
(Tue, 04 Aug 2015 22:32:02 GMT)
Full text and
rfc822 format available.
Did not alter fixed versions and reopened.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 04 Aug 2015 22:43:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
11098 <at> debbugs.gnu.org and Hugo Guérineau <hugo.guerineau <at> wwsight.com>
Request was from
Assaf Gordon <assafgordon <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Wed, 24 Oct 2018 21:59:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 22 Nov 2018 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 209 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.