bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Bruno Haible
Subject: Re: [PATCH] getdate add a week when the wday is the same as the current one
Date: Fri, 1 May 2009 13:03:59 +0200
User-agent: KMail/1.9.9

Jim Meyering wrote:
>         tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
> +                      + 7 * (pc.day_ordinal
> +                             + (0 < pc.day_ordinal
> +                                && tm.tm_wday == pc.day_number)
> +                             - (0 < pc.day_ordinal)));

This can be simplified to

          tm.tm_mday += ((pc.day_number - tm.tm_wday + 7) % 7
                         + 7 * (pc.day_ordinal
                                - (0 < pc.day_ordinal
                                   && tm.tm_wday != pc.day_number)));

Bruno




reply via email to

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