bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] getdate add a week when the wday is the same as the current one


From: Giuseppe Scrivano
Subject: [PATCH] getdate add a week when the wday is the same as the current one
Date: Thu, 30 Apr 2009 22:10:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux)

Hello,

what do you think of the following patch?  When the same day as the
current one is provided then a week is added.  It doesn't change the
behaviour for days in the past.

It closes coreutils #25406.

Giuseppe


diff --git a/lib/getdate.y b/lib/getdate.y
index 877b264..8154fd9 100644
--- a/lib/getdate.y
+++ b/lib/getdate.y
@@ -1435,7 +1435,7 @@ get_date (struct timespec *result, char const *p, struct 
timespec const *now)
       if (pc.days_seen && ! pc.dates_seen)
        {
          tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
-                        + 7 * (pc.day_ordinal - (0 < pc.day_ordinal)));
+                   + 7 * (pc.day_ordinal + (pc.day_ordinal > 0 && tm.tm_wday 
== pc.day_number) - (0 < pc.day_ordinal)));
          tm.tm_isdst = -1;
          Start = mktime (&tm);
          if (Start == (time_t) -1)




reply via email to

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