[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: r1.100 of getdate.y changed 'ago' behavior
From: |
Edgar Toernig |
Subject: |
Re: r1.100 of getdate.y changed 'ago' behavior |
Date: |
Tue, 25 Apr 2006 22:13:51 +0200 |
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.
address@hidden 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.
+
address@hidden 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}
- r1.100 of getdate.y changed 'ago' behavior, Mike Frysinger, 2006/04/19
- Re: r1.100 of getdate.y changed 'ago' behavior, Paul Eggert, 2006/04/20
- Re: r1.100 of getdate.y changed 'ago' behavior, The Wanderer, 2006/04/20
- Re: r1.100 of getdate.y changed 'ago' behavior,
Edgar Toernig <=
- Re: r1.100 of getdate.y changed 'ago' behavior, Paul Eggert, 2006/04/25
- Re: r1.100 of getdate.y changed 'ago' behavior, Edgar Toernig, 2006/04/25
- Message not available
- Message not available
- Message not available
- Message not available
- Message not available
- Re: r1.100 of getdate.y changed 'ago' behavior, Edgar Toernig, 2006/04/26
- Re: r1.100 of getdate.y changed 'ago' behavior, James Youngman, 2006/04/28