X-Loop: help-debbugs@HIDDEN Subject: bug#8357: coreutils bug in date Resent-From: Heikki Orsila <shd@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-To: owner <at> debbugs.gnu.org Resent-CC: bug-coreutils@HIDDEN Resent-Date: Sun, 27 Mar 2011 21:55:02 +0000 Resent-Message-ID: <handler.8357.B.130126286327630 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 8357 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8357 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.130126286327630 (code B ref -1); Sun, 27 Mar 2011 21:55:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 Mar 2011 21:54:23 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Q3xug-0007Bb-6V for submit <at> debbugs.gnu.org; Sun, 27 Mar 2011 17:54:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <shd@HIDDEN>) id 1Q3xkl-0006w5-G5 for submit <at> debbugs.gnu.org; Sun, 27 Mar 2011 17:44:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <shd@HIDDEN>) id 1Q3xkf-0006gI-Rk for submit <at> debbugs.gnu.org; Sun, 27 Mar 2011 17:44:02 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:55382) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <shd@HIDDEN>) id 1Q3xkf-0006gC-Pi for submit <at> debbugs.gnu.org; Sun, 27 Mar 2011 17:44:01 -0400 Received: from [140.186.70.92] (port=45911 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q3xke-00005J-KO for bug-coreutils@HIDDEN; Sun, 27 Mar 2011 17:44:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <shd@HIDDEN>) id 1Q3xkd-0006fs-Fm for bug-coreutils@HIDDEN; Sun, 27 Mar 2011 17:44:00 -0400 Received: from mail.cs.tut.fi ([130.230.4.42]:53209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <shd@HIDDEN>) id 1Q3xkd-0006fQ-9y for bug-coreutils@HIDDEN; Sun, 27 Mar 2011 17:43:59 -0400 Received: from amavis1.cs.tut.fi (amavis1.cs.tut.fi [130.230.4.69]) by mail.cs.tut.fi (Postfix) with ESMTP id AB55E363 for <bug-coreutils@HIDDEN>; Mon, 28 Mar 2011 00:43:55 +0300 (EEST) Received: from mail.cs.tut.fi ([130.230.4.42]) by amavis1.cs.tut.fi (amavis1.cs.tut.fi [130.230.4.69]) (amavisd-maia, port 10024) with ESMTP id 10862-08 for <bug-coreutils@HIDDEN>; Mon, 28 Mar 2011 00:43:54 +0300 (EEST) Received: from coffee.modeemi.fi (coffee.modeemi.fi [130.230.72.140]) by mail.cs.tut.fi (Postfix) with ESMTP id BAECD362 for <bug-coreutils@HIDDEN>; Mon, 28 Mar 2011 00:43:54 +0300 (EEST) Received: by coffee.modeemi.fi (Postfix, from userid 16311) id 6A55E2D69F4; Mon, 28 Mar 2011 00:43:54 +0300 (EEST) Date: Mon, 28 Mar 2011 00:43:54 +0300 From: Heikki Orsila <shd@HIDDEN> Message-ID: <20110327214354.GF29701@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.2 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -6.6 (------) X-Mailman-Approved-At: Sun, 27 Mar 2011 17:54:21 -0400 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -6.6 (------) Hello, I found a case where GNU date works pretty oddly. At 2011-03-27 Finland moved to 'summer time'. After midnight at 2011-03-28 our web site's cron script did (date -I -d yesterday) which yielded unexpected results: $ date Mon Mar 28 00:36:07 EEST 2011 $ date -I -d yesterday 2011-03-26 $ date -I -d '24 hours ago' 2011-03-26 Our scripts produced bad results due to this "feature/bug". Maybe our fault, but this is definitely unexpected behaviour. -- Heikki Orsila heikki.orsila@HIDDEN http://www.iki.fi/shd
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Heikki Orsila <shd@HIDDEN> Subject: bug#8357: Acknowledgement (coreutils bug in date) Message-ID: <handler.8357.B.130126286327630.ack <at> debbugs.gnu.org> References: <20110327214354.GF29701@HIDDEN> X-Gnu-PR-Message: ack 8357 X-Gnu-PR-Package: coreutils Reply-To: 8357 <at> debbugs.gnu.org Date: Sun, 27 Mar 2011 21:55:02 +0000 Thank you for filing a new bug report with GNU. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 8357 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 8357: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8357 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#8357: coreutils bug in date Resent-From: Bob Proulx <bob@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-To: owner <at> debbugs.gnu.org Resent-CC: bug-coreutils@HIDDEN Resent-Date: Mon, 28 Mar 2011 00:05:02 +0000 Resent-Message-ID: <handler.8357.B8357.13012706916096 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 8357 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Heikki Orsila <shd@HIDDEN> Cc: 8357 <at> debbugs.gnu.org Received: via spool by 8357-submit <at> debbugs.gnu.org id=B8357.13012706916096 (code B ref 8357); Mon, 28 Mar 2011 00:05:02 +0000 Received: (at 8357) by debbugs.gnu.org; 28 Mar 2011 00:04:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Q3zwt-0001aD-HO for submit <at> debbugs.gnu.org; Sun, 27 Mar 2011 20:04:50 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1Q3zwq-0001Zm-Dj; Sun, 27 Mar 2011 20:04:45 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 0560A21311; Sun, 27 Mar 2011 18:04:38 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id E513B2DC52; Sun, 27 Mar 2011 18:04:37 -0600 (MDT) Date: Sun, 27 Mar 2011 18:04:37 -0600 From: Bob Proulx <bob@HIDDEN> Message-ID: <20110328000437.GA4555@HIDDEN> References: <20110327214354.GF29701@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110327214354.GF29701@HIDDEN> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.4 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.4 (--) tags 8357 + moreinfo notabug thanks Heikki Orsila wrote: > Hello, I found a case where GNU date works pretty oddly. > At 2011-03-27 Finland moved to 'summer time'. After midnight at 2011-03-28 > our web site's cron script did (date -I -d yesterday) which yielded > unexpected results: > > $ date > Mon Mar 28 00:36:07 EEST 2011 > $ date -I -d yesterday > 2011-03-26 > $ date -I -d '24 hours ago' > 2011-03-26 > > Our scripts produced bad results due to this "feature/bug". Maybe our fault, > but this is definitely unexpected behaviour. Thank you for your bug report. However I this is not a bug in date but a misunderstanding of how relative times and DST interact. Note that 'date -I' is a deprecated option. Please consider updating the syntax. In a future release -I may be removed. First, let's understand when the time changes. $ zdump -v Europe/Helsinki | grep 2011 Europe/Helsinki Sun Mar 27 00:59:59 2011 UTC = Sun Mar 27 02:59:59 2011 EET isdst=0 gmtoff=7200 Europe/Helsinki Sun Mar 27 01:00:00 2011 UTC = Sun Mar 27 04:00:00 2011 EEST isdst=1 gmtoff=10800 Europe/Helsinki Sun Oct 30 00:59:59 2011 UTC = Sun Oct 30 03:59:59 2011 EEST isdst=1 gmtoff=10800 Europe/Helsinki Sun Oct 30 01:00:00 2011 UTC = Sun Oct 30 03:00:00 2011 EET isdst=0 gmtoff=7200 Sun Mar 27 02:59:59 2011 EET was the last second in EET and Sun Mar 27 04:00:00 2011 EEST was the very next second in your timezone. There is no 03:00:00 through 03:59:59. The time skips (by law and politics) directly to 04:00:00 in that timezone. The day is defined to be one hour shorter that day. The documentation for date says: The unit of time displacement may be selected by the string `year' or `month' for moving by whole years or months. These are fuzzy units, as years and months are not all of equal duration. More precise units are `fortnight' which is worth 14 days, `week' worth 7 days, `day' worth 24 hours, `hour' worth 60 minutes, `minute' or `min' worth 60 seconds, and `second' or `sec' worth one second. An `s' suffix on these units is accepted and ignored. The string `tomorrow' is worth one day in the future (equivalent to `day'), the string `yesterday' is worth one day in the past (equivalent to `day ago'). So 'yesterday' or '24 hours ago' are equivalent. These are exactly 24 hours ago or 86400 seconds. This is a critical point in your problem. $ TZ=Europe/Helsinki date -d 'Mon Mar 28 00:36:07 EEST 2011' Mon Mar 28 00:36:07 EEST 2011 $ TZ=Europe/Helsinki date -d 'Mon Mar 28 00:36:07 EEST 2011 24 hours ago' Sat Mar 26 23:36:07 EET 2011 This recreates the same results you posted. The reasoning is a little more obvious if I list out the hours explicitly. Mon Mar 28 00:36:07 EEST 2011 -0 hours Sun Mar 27 23:36:07 EEST 2011 -1 hours Sun Mar 27 22:36:07 EEST 2011 -2 hours Sun Mar 27 21:36:07 EEST 2011 -3 hours Sun Mar 27 20:36:07 EEST 2011 -4 hours Sun Mar 27 19:36:07 EEST 2011 -5 hours Sun Mar 27 18:36:07 EEST 2011 -6 hours Sun Mar 27 17:36:07 EEST 2011 -7 hours Sun Mar 27 16:36:07 EEST 2011 -8 hours Sun Mar 27 15:36:07 EEST 2011 -9 hours Sun Mar 27 14:36:07 EEST 2011 -10 hours Sun Mar 27 13:36:07 EEST 2011 -11 hours Sun Mar 27 12:36:07 EEST 2011 -12 hours Sun Mar 27 11:36:07 EEST 2011 -13 hours Sun Mar 27 10:36:07 EEST 2011 -14 hours Sun Mar 27 09:36:07 EEST 2011 -15 hours Sun Mar 27 08:36:07 EEST 2011 -16 hours Sun Mar 27 07:36:07 EEST 2011 -17 hours Sun Mar 27 06:36:07 EEST 2011 -18 hours Sun Mar 27 05:36:07 EEST 2011 -19 hours Sun Mar 27 04:36:07 EEST 2011 -20 hours <-- just after change Sun Mar 27 02:36:07 EET 2011 -21 hours <-- just before change Sun Mar 27 01:36:07 EET 2011 -22 hours Sun Mar 27 00:36:07 EET 2011 -23 hours Sat Mar 26 23:36:07 EET 2011 -24 hours Observe that there is no 03:00:00-03:59:59 and March 27 is only 23 hours long that day. It is shorter than 24 hours. Using a 24 hour calculation near midnight skips over that day completely. With this table it should be obvious that date is behaving correctly and the day that is shorter than 24 hours due to the conversion to DST has caused -24 hours to skip completely over it. Please see this FAQ entry for detailed explanation and hints on how to avoid this problem. http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e Instead of doing calculations around DST I suggest using calculations around noon. I am not aware of any location that changes DST at noon which makes it a much safer time to do date calculations. The FAQ entry provides examples. Or if possible use UTC which also avoids the problem by never switching to DST. Bob
Received: (at control) by debbugs.gnu.org; 28 Mar 2011 00:04:51 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 27 20:04:51 2011 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Q3zww-0001aI-UD for submit <at> debbugs.gnu.org; Sun, 27 Mar 2011 20:04:51 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1Q3zwq-0001Zm-Dj; Sun, 27 Mar 2011 20:04:45 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 0560A21311; Sun, 27 Mar 2011 18:04:38 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id E513B2DC52; Sun, 27 Mar 2011 18:04:37 -0600 (MDT) Date: Sun, 27 Mar 2011 18:04:37 -0600 From: Bob Proulx <bob@HIDDEN> To: Heikki Orsila <shd@HIDDEN> Subject: Re: bug#8357: coreutils bug in date Message-ID: <20110328000437.GA4555@HIDDEN> References: <20110327214354.GF29701@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110327214354.GF29701@HIDDEN> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: control Cc: 8357 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.4 (--) tags 8357 + moreinfo notabug thanks Heikki Orsila wrote: > Hello, I found a case where GNU date works pretty oddly. > At 2011-03-27 Finland moved to 'summer time'. After midnight at 2011-03-28 > our web site's cron script did (date -I -d yesterday) which yielded > unexpected results: > > $ date > Mon Mar 28 00:36:07 EEST 2011 > $ date -I -d yesterday > 2011-03-26 > $ date -I -d '24 hours ago' > 2011-03-26 > > Our scripts produced bad results due to this "feature/bug". Maybe our fault, > but this is definitely unexpected behaviour. Thank you for your bug report. However I this is not a bug in date but a misunderstanding of how relative times and DST interact. Note that 'date -I' is a deprecated option. Please consider updating the syntax. In a future release -I may be removed. First, let's understand when the time changes. $ zdump -v Europe/Helsinki | grep 2011 Europe/Helsinki Sun Mar 27 00:59:59 2011 UTC = Sun Mar 27 02:59:59 2011 EET isdst=0 gmtoff=7200 Europe/Helsinki Sun Mar 27 01:00:00 2011 UTC = Sun Mar 27 04:00:00 2011 EEST isdst=1 gmtoff=10800 Europe/Helsinki Sun Oct 30 00:59:59 2011 UTC = Sun Oct 30 03:59:59 2011 EEST isdst=1 gmtoff=10800 Europe/Helsinki Sun Oct 30 01:00:00 2011 UTC = Sun Oct 30 03:00:00 2011 EET isdst=0 gmtoff=7200 Sun Mar 27 02:59:59 2011 EET was the last second in EET and Sun Mar 27 04:00:00 2011 EEST was the very next second in your timezone. There is no 03:00:00 through 03:59:59. The time skips (by law and politics) directly to 04:00:00 in that timezone. The day is defined to be one hour shorter that day. The documentation for date says: The unit of time displacement may be selected by the string `year' or `month' for moving by whole years or months. These are fuzzy units, as years and months are not all of equal duration. More precise units are `fortnight' which is worth 14 days, `week' worth 7 days, `day' worth 24 hours, `hour' worth 60 minutes, `minute' or `min' worth 60 seconds, and `second' or `sec' worth one second. An `s' suffix on these units is accepted and ignored. The string `tomorrow' is worth one day in the future (equivalent to `day'), the string `yesterday' is worth one day in the past (equivalent to `day ago'). So 'yesterday' or '24 hours ago' are equivalent. These are exactly 24 hours ago or 86400 seconds. This is a critical point in your problem. $ TZ=Europe/Helsinki date -d 'Mon Mar 28 00:36:07 EEST 2011' Mon Mar 28 00:36:07 EEST 2011 $ TZ=Europe/Helsinki date -d 'Mon Mar 28 00:36:07 EEST 2011 24 hours ago' Sat Mar 26 23:36:07 EET 2011 This recreates the same results you posted. The reasoning is a little more obvious if I list out the hours explicitly. Mon Mar 28 00:36:07 EEST 2011 -0 hours Sun Mar 27 23:36:07 EEST 2011 -1 hours Sun Mar 27 22:36:07 EEST 2011 -2 hours Sun Mar 27 21:36:07 EEST 2011 -3 hours Sun Mar 27 20:36:07 EEST 2011 -4 hours Sun Mar 27 19:36:07 EEST 2011 -5 hours Sun Mar 27 18:36:07 EEST 2011 -6 hours Sun Mar 27 17:36:07 EEST 2011 -7 hours Sun Mar 27 16:36:07 EEST 2011 -8 hours Sun Mar 27 15:36:07 EEST 2011 -9 hours Sun Mar 27 14:36:07 EEST 2011 -10 hours Sun Mar 27 13:36:07 EEST 2011 -11 hours Sun Mar 27 12:36:07 EEST 2011 -12 hours Sun Mar 27 11:36:07 EEST 2011 -13 hours Sun Mar 27 10:36:07 EEST 2011 -14 hours Sun Mar 27 09:36:07 EEST 2011 -15 hours Sun Mar 27 08:36:07 EEST 2011 -16 hours Sun Mar 27 07:36:07 EEST 2011 -17 hours Sun Mar 27 06:36:07 EEST 2011 -18 hours Sun Mar 27 05:36:07 EEST 2011 -19 hours Sun Mar 27 04:36:07 EEST 2011 -20 hours <-- just after change Sun Mar 27 02:36:07 EET 2011 -21 hours <-- just before change Sun Mar 27 01:36:07 EET 2011 -22 hours Sun Mar 27 00:36:07 EET 2011 -23 hours Sat Mar 26 23:36:07 EET 2011 -24 hours Observe that there is no 03:00:00-03:59:59 and March 27 is only 23 hours long that day. It is shorter than 24 hours. Using a 24 hour calculation near midnight skips over that day completely. With this table it should be obvious that date is behaving correctly and the day that is shorter than 24 hours due to the conversion to DST has caused -24 hours to skip completely over it. Please see this FAQ entry for detailed explanation and hints on how to avoid this problem. http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e Instead of doing calculations around DST I suggest using calculations around noon. I am not aware of any location that changes DST at noon which makes it a much safer time to do date calculations. The FAQ entry provides examples. Or if possible use UTC which also avoids the problem by never switching to DST. Bob
X-Loop: help-debbugs@HIDDEN Subject: bug#8357: coreutils bug in date Resent-From: Heikki Orsila <shd@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-To: owner <at> debbugs.gnu.org Resent-CC: bug-coreutils@HIDDEN Resent-Date: Mon, 28 Mar 2011 06:28:01 +0000 Resent-Message-ID: <handler.8357.B8357.130129365911731 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 8357 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug moreinfo To: Bob Proulx <bob@HIDDEN> Cc: 8357 <at> debbugs.gnu.org Received: via spool by 8357-submit <at> debbugs.gnu.org id=B8357.130129365911731 (code B ref 8357); Mon, 28 Mar 2011 06:28:01 +0000 Received: (at 8357) by debbugs.gnu.org; 28 Mar 2011 06:27:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Q45vO-00033A-Ia for submit <at> debbugs.gnu.org; Mon, 28 Mar 2011 02:27:38 -0400 Received: from mail.cs.tut.fi ([130.230.4.42]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <shd@HIDDEN>) id 1Q45vM-00032y-Qs for 8357 <at> debbugs.gnu.org; Mon, 28 Mar 2011 02:27:37 -0400 Received: from amavis1.cs.tut.fi (amavis1.cs.tut.fi [130.230.4.69]) by mail.cs.tut.fi (Postfix) with ESMTP id 9C9904E7; Mon, 28 Mar 2011 09:27:30 +0300 (EEST) Received: from mail.cs.tut.fi ([130.230.4.42]) by amavis1.cs.tut.fi (amavis1.cs.tut.fi [130.230.4.69]) (amavisd-maia, port 10024) with ESMTP id 11541-45; Mon, 28 Mar 2011 09:27:29 +0300 (EEST) Received: from coffee.modeemi.fi (coffee.modeemi.fi [130.230.72.140]) by mail.cs.tut.fi (Postfix) with ESMTP id 9DA764E5; Mon, 28 Mar 2011 09:27:28 +0300 (EEST) Received: by coffee.modeemi.fi (Postfix, from userid 16311) id 663582D69F5; Mon, 28 Mar 2011 09:27:28 +0300 (EEST) Date: Mon, 28 Mar 2011 09:27:28 +0300 From: Heikki Orsila <shd@HIDDEN> Message-ID: <20110328062728.GG29701@HIDDEN> References: <20110327214354.GF29701@HIDDEN> <20110328000437.GA4555@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20110328000437.GA4555@HIDDEN> User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.2 X-Spam-Score: -5.1 (-----) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -4.6 (----) On Sun, Mar 27, 2011 at 06:04:37PM -0600, Bob Proulx wrote: > Thank you for your bug report. However I this is not a bug in date > but a misunderstanding of how relative times and DST interact. > ... > The string `tomorrow' is worth one day in the future (equivalent to > `day'), the string `yesterday' is worth one day in the past (equivalent > to `day ago'). > > So 'yesterday' or '24 hours ago' are equivalent. These are exactly 24 > hours ago or 86400 seconds. This is a critical point in your problem. I see the problem, but IMO, the definition of yesterday should be changed or there should be a new definition. What about defining new units: 'calday', 'calyesterday', 'caltomorrow'? For example, $(date -d '1 calday ago' '+%F')? These would count actual calendar days rather than relative time (in units of 24 hours)? Yes I know there is a work around in the doc you provided (thanks for that). Heikki Orsila
X-Loop: help-debbugs@HIDDEN Subject: bug#8357: coreutils bug in date Resent-From: Bob Proulx <bob@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-To: owner <at> debbugs.gnu.org Resent-CC: bug-coreutils@HIDDEN Resent-Date: Tue, 29 Mar 2011 20:39:01 +0000 Resent-Message-ID: <handler.8357.B8357.13014310983611 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 8357 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug moreinfo To: Heikki Orsila <shd@HIDDEN> Cc: 8357 <at> debbugs.gnu.org Received: via spool by 8357-submit <at> debbugs.gnu.org id=B8357.13014310983611 (code B ref 8357); Tue, 29 Mar 2011 20:39:01 +0000 Received: (at 8357) by debbugs.gnu.org; 29 Mar 2011 20:38:18 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Q4fg8-0000wC-UI for submit <at> debbugs.gnu.org; Tue, 29 Mar 2011 16:38:17 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1Q4fg6-0000vz-9v for 8357 <at> debbugs.gnu.org; Tue, 29 Mar 2011 16:38:15 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id A499721311; Tue, 29 Mar 2011 14:38:08 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 948D42DC53; Tue, 29 Mar 2011 14:38:08 -0600 (MDT) Date: Tue, 29 Mar 2011 14:38:08 -0600 From: Bob Proulx <bob@HIDDEN> Message-ID: <20110329203808.GA9850@HIDDEN> References: <20110327214354.GF29701@HIDDEN> <20110328000437.GA4555@HIDDEN> <20110328062728.GG29701@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110328062728.GG29701@HIDDEN> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.4 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.4 (--) Heikki Orsila wrote: > Bob Proulx wrote: > > So 'yesterday' or '24 hours ago' are equivalent. These are exactly 24 > > hours ago or 86400 seconds. This is a critical point in your problem. > > I see the problem, but IMO, the definition of yesterday should be changed > or there should be a new definition. > > What about defining new units: 'calday', 'calyesterday', 'caltomorrow'? > For example, $(date -d '1 calday ago' '+%F')? These would count actual > calendar days rather than relative time (in units of 24 hours)? Something like that could be done. I think there would be support for that direction of development. That is the problem when people put in features such as the relative date calculations. A simple but only partially implemented feature sounds great but later causes an endless stream of problems. They add a partially nice feature but it isn't 100% perfect and then ten years go by and people start to use it and then find the rough spots. But by then it is now a very long standing behavior and can't be changed. Your suggestion to use different names avoids breaking the previous behavior. But still someone would need to actually do the work and the code is not simple. Working with human produced calender dates has many traps and pitfalls. Bob
X-Loop: help-debbugs@HIDDEN Subject: bug#8357: coreutils bug in date Resent-From: Bob Proulx <bob@HIDDEN> Original-Sender: debbugs-submit-bounces <at> debbugs.gnu.org Resent-To: owner <at> debbugs.gnu.org Resent-CC: bug-coreutils@HIDDEN Resent-Date: Sun, 10 Apr 2011 03:50:03 +0000 Resent-Message-ID: <handler.8357.B8357.130240737728003 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 8357 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug moreinfo To: Heikki Orsila <shd@HIDDEN> Cc: 8357 <at> debbugs.gnu.org Received: via spool by 8357-submit <at> debbugs.gnu.org id=B8357.130240737728003 (code B ref 8357); Sun, 10 Apr 2011 03:50:03 +0000 Received: (at 8357) by debbugs.gnu.org; 10 Apr 2011 03:49:37 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Q8leb-0007Hb-8y for submit <at> debbugs.gnu.org; Sat, 09 Apr 2011 23:49:37 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1Q8leZ-0007HP-K7 for 8357 <at> debbugs.gnu.org; Sat, 09 Apr 2011 23:49:36 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 0F3EC21638; Sat, 9 Apr 2011 21:49:30 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id F401B2DC53; Sat, 9 Apr 2011 21:49:29 -0600 (MDT) Date: Sat, 9 Apr 2011 21:49:29 -0600 From: Bob Proulx <bob@HIDDEN> Message-ID: <20110410034929.GA11268@HIDDEN> References: <20110327214354.GF29701@HIDDEN> <20110328000437.GA4555@HIDDEN> <20110328062728.GG29701@HIDDEN> <20110329203808.GA9850@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110329203808.GA9850@HIDDEN> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.4 (--) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.4 (--) retitle 8357 Improve yesterday and tomorrow calculations for common cases severity 8357 wishlist thanks Bob Proulx wrote: > Heikki Orsila wrote: > > Bob Proulx wrote: > > > So 'yesterday' or '24 hours ago' are equivalent. These are exactly 24 > > > hours ago or 86400 seconds. This is a critical point in your problem. > > > > I see the problem, but IMO, the definition of yesterday should be changed > > or there should be a new definition. > > > > What about defining new units: 'calday', 'calyesterday', 'caltomorrow'? > > For example, $(date -d '1 calday ago' '+%F')? These would count actual > > calendar days rather than relative time (in units of 24 hours)? > > Something like that could be done. I think there would be support for > that direction of development. There hasn't been any further discussion about the topic. I don't think this is going to be changed immediately. It would need to be discussed and an acceptable solution proposed and also someone would need to actually do the work. And so am reclassifying this ticket as a wishlist to improve the date handling for the common cases of yesterday and tomorrow just to document the issue. Bob
Received: (at control) by debbugs.gnu.org; 28 Jul 2011 21:39:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 28 17:39:33 2011 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1QmYIm-0000xP-Ex for submit <at> debbugs.gnu.org; Thu, 28 Jul 2011 17:39:33 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1QmYIk-0000xH-6b for control <at> debbugs.gnu.org; Thu, 28 Jul 2011 17:39:30 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id DA8E221412 for <control <at> debbugs.gnu.org>; Thu, 28 Jul 2011 15:39:27 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id A3ED12DC70; Thu, 28 Jul 2011 15:39:27 -0600 (MDT) Date: Thu, 28 Jul 2011 15:39:27 -0600 From: Bob Proulx <bob@HIDDEN> To: control <at> debbugs.gnu.org Subject: wishlist 8357 Message-ID: <20110728213927.GA1632@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.4 (--) retitle 8357 Improve yesterday and tomorrow calculations for common cases severity 8357 wishlist thanks This should have been changed a while ago so catching up now.
Received: (at control) by debbugs.gnu.org; 28 Jul 2011 21:39:33 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 28 17:39:33 2011 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1QmYIm-0000xP-Ex for submit <at> debbugs.gnu.org; Thu, 28 Jul 2011 17:39:33 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1QmYIk-0000xH-6b for control <at> debbugs.gnu.org; Thu, 28 Jul 2011 17:39:30 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id DA8E221412 for <control <at> debbugs.gnu.org>; Thu, 28 Jul 2011 15:39:27 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id A3ED12DC70; Thu, 28 Jul 2011 15:39:27 -0600 (MDT) Date: Thu, 28 Jul 2011 15:39:27 -0600 From: Bob Proulx <bob@HIDDEN> To: control <at> debbugs.gnu.org Subject: wishlist 8357 Message-ID: <20110728213927.GA1632@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.4 (--) retitle 8357 Improve yesterday and tomorrow calculations for common cases severity 8357 wishlist thanks This should have been changed a while ago so catching up now.
Received: (at control) by debbugs.gnu.org; 6 Aug 2011 17:24:21 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Aug 06 13:24:21 2011 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1Qpkbk-0007ur-Sf for submit <at> debbugs.gnu.org; Sat, 06 Aug 2011 13:24:21 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <bob@HIDDEN>) id 1Qpkbj-0007ul-Fw for control <at> debbugs.gnu.org; Sat, 06 Aug 2011 13:24:19 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 71D0421361 for <control <at> debbugs.gnu.org>; Sat, 6 Aug 2011 11:23:27 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 4EF0D2DC71; Sat, 6 Aug 2011 11:23:27 -0600 (MDT) Date: Sat, 6 Aug 2011 11:23:27 -0600 From: Bob Proulx <bob@HIDDEN> To: control <at> debbugs.gnu.org Subject: remove tag Message-ID: <20110806172327.GA23345@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -2.5 (--) tag 8357 - moreinfo thanks
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.