bug-mcron
[Top][All Lists]
Advanced

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

Re: [Bug-mcron] Documentation error (every second sunday)


From: Mathieu Lirzin
Subject: Re: [Bug-mcron] Documentation error (every second sunday)
Date: Sat, 26 Jan 2019 12:48:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello Adam,

Adam Tack <address@hidden> writes:

> I think that there's an error in the Texinfo page for mcron in the
> "Every second Sunday" section:
>
> https://www.gnu.org/software/mcron/manual/mcron.html#Every-second-Sunday
>
> If the first day of the next month is a Sunday, then we should only
> *add* 7 days, so that the eighth is also a Sunday.
>
> Hence, the example should be:
>
> #+BEGIN_SRC scheme
> (job (lambda (current-time)
>        (let* ((next-month (next-month-from current-time))
>               (first-day (tm:wday (localtime next-month)))
>               (second-sunday (if (eqv? first-day 0)
>                                  7
>                                  (- 14 first-day))))
>          (+ next-month (* 24 60 60 second-sunday))))
>      "my-program")
> #+END_SRC
>
>
> (Arguably ~second-sunday~ as a variable name is a bit of a misnomer.)

Have you a better name in mind?

> If you wish to test this, to be sure, compare the effect of the (current)
> function when finding the second Sunday of August (with July 2, as the
> starting time), and the second Sunday of September (with August 2, as
> the starting time). (September 1 was a Sunday, while August 1 wasn't.)

Thanks for providing a test to reproduce the issue.

I was not familiar with this example in the manual, but your example
seems convincing.

I think it might be helpful to add a test case for this.  Are you
interested in doing so?

> Sorry for the unsubstantial bug report, but this was driving me crazy
> while I tried to figure out what I wasn't getting (especially as it
> was "left as an exercise to the student to understand how this
> works").

Don't be sorry.  I am not sure the “left as an exercise” thing is
appropriate in a software manual.  :-)

Thanks

-- 
Mathieu Lirzin
GPG: F2A3 8D7E EB2B 6640 5761  070D 0ADE E100 9460 4D37



reply via email to

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