bug-coreutils
[Top][All Lists]
Advanced

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

Re: Date 5.94 bug


From: Paul Eggert
Subject: Re: Date 5.94 bug
Date: Tue, 25 Apr 2006 03:46:30 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Mike Frysinger <address@hidden> writes:

> http://lists.gnu.org/archive/html/bug-coreutils/2006-04/msg00134.html

No, that older report about "date -d '1 hour 1 minute ago'" is
unrelated.  As far as I know, nobody yet has had the time to look into
implementing the code+documentation change requested by the older report.
The Wanderer volunteered to do that but his time is limited; if the
matter is urgent to you perhaps you could give it a try.

Anyway, the newly reported behavior is a bug, so I installed this
patch into coreutils (and gnulib, for getdate.y).  Thanks for
reporting it, Mr. McDole.

2006-04-25  Paul Eggert  <address@hidden>

        * lib/getdate.y (get_date): When adding relative date, start with the
        initial time, not with the result of the first mktime call.
        * tests/misc/date (relative-3): New test, derived from a bug
        report by John Thomas McDole.

--- lib/getdate.y       13 Aug 2005 12:10:05 -0000      1.101
+++ lib/getdate.y       25 Apr 2006 10:26:58 -0000
@@ -1,7 +1,7 @@
 %{
 /* Parse a string into an internal time stamp.
 
-   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Free Software
+   Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -1437,6 +1437,10 @@ get_date (struct timespec *result, char 
          tm.tm_year = year;
          tm.tm_mon = month;
          tm.tm_mday = day;
+         tm.tm_hour = tm0.tm_hour;
+         tm.tm_min = tm0.tm_min;
+         tm.tm_sec = tm0.tm_sec;
+         tm.tm_isdst = tm0.tm_isdst;
          Start = mktime (&tm);
          if (Start == (time_t) -1)
            goto fail;
--- tests/misc/date     24 Sep 2005 07:57:36 -0000      1.21
+++ tests/misc/date     25 Apr 2006 10:26:58 -0000
@@ -177,6 +177,10 @@ my @Tests =
       {OUT=>"2000-06-15 09:43:57"},
       {ENV => 'TZ=UTC+1'}],
 
+     # Relative days, no time, across time zones.
+     ['relative-3', "-I -d '2006-04-23 21 days ago'", {OUT=>"2006-04-02"},
+        {ENV=>'TZ=PST8PDT,M4.1.0,M10.5.0'}],
+
      # This would infloop (or appear to) prior to coreutils-4.5.5,
      # due to a bug in strftime.c.
      ['wide-fmt', "-d '1999-06-01'", '+%3004Y', {OUT=>'0' x 3000 . "1999"}],




reply via email to

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