Paul Eggert wrote: > > I suppose you might be able to talk me into that, but in that case we > need to fix the code and the documentation both. Any volunteers?
Here's a patch. Ciao, ET. diff -rup coreutils-5.94.orig/lib/getdate.y coreutils-5.94/lib/getdate.y --- coreutils-5.94.orig/lib/getdate.y 2005-08-13 14:10:05 +0200 +++ coreutils-5.94/lib/getdate.y 2006-04-25 20:49:56 +0200 @@ -454,15 +454,15 @@ date: ; rel: - relunit tAGO + rel tAGO { - pc->rel.ns -= $1.ns; - pc->rel.seconds -= $1.seconds; - pc->rel.minutes -= $1.minutes; - pc->rel.hour -= $1.hour; - pc->rel.day -= $1.day; - pc->rel.month -= $1.month; - pc->rel.year -= $1.year; + pc->rel.ns *= -1; + pc->rel.seconds *= -1; + pc->rel.minutes *= -1; + pc->rel.hour *= -1; + pc->rel.day *= -1; + pc->rel.month *= -1; + pc->rel.year *= -1; } | relunit { diff -rup coreutils-5.94.orig/tests/misc/date coreutils-5.94/tests/misc/date --- coreutils-5.94.orig/tests/misc/date 2005-09-24 09:57:36 +0200 +++ coreutils-5.94/tests/misc/date 2006-04-25 21:33:42 +0200 @@ -109,6 +109,8 @@ my @Tests = ['rel-3a', "-d '$d1 4 seconds ago' $fmt", {OUT=>"$d0 08:17:44"}], + ['rel-4a', "-d '$d1 1 hour 30 minutes ago' $fmt", {OUT=>"$d0 06:47:48"}], + ['next-s', "-d '$d1 next second' '+%Y-%m-%d %T'", {OUT=>"$d0 $ts"}], ['next-m', "-d '$d1 next minute' '+%Y-%m-%d %T'", {OUT=>"$d0 $tm"}], ['next-h', "-d '$d1 next hour' '+%Y-%m-%d %T'", {OUT=>"$d0 $th"}], diff -rup coreutils-5.94.orig/doc/getdate.texi coreutils-5.94/doc/getdate.texi --- coreutils-5.94.orig/doc/getdate.texi 2005-05-11 22:27:11 +0200 +++ coreutils-5.94/doc/getdate.texi 2006-04-25 21:20:57 +0200 @@ -345,6 +345,7 @@ examples: 1 year ago 3 years 2 days +1 hour 30 minutes ago @end example @findex year @r{in date strings} @@ -363,12 +364,14 @@ days, @samp{day} worth 24 hours, @samp{h @samp{sec} worth one second. An @samp{s} suffix on these units is accepted and ignored. [EMAIL PROTECTED] ago @r{in date strings} The unit of time may be preceded by a multiplier, given as an optionally signed number. Unsigned numbers are taken as positively signed. No -number at all implies 1 for a multiplier. Following a relative item by -the string @samp{ago} is equivalent to preceding the unit by a -multiplier with value @math{-1}. +number at all implies 1 for a multiplier. + [EMAIL PROTECTED] ago @r{in date strings} +The string @samp{ago} multiplies the accumulated time displacement to +its left with the value @math{-1}. For example, @samp{1 hour 30 minutes +ago} is the same as @samp{-90 minutes}. @findex day @r{in date strings} @findex tomorrow @r{in date strings} _______________________________________________ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils