[Toybox] [PATCH] crond: Fix timing
Rob Landley
rob at landley.net
Sun Jan 12 14:41:02 PST 2025
On 1/12/25 15:58, Kana Steimle wrote:
> It seems the original author of crond slightly messed up the logic for
> checking whether the current time matches the time that was specified.
> This patch fixes it.
>
> For some reason there was an OR where there should have been an AND,
> which meant if the time and day of month OR the month and day of week
> match the current time, the job would run. So you'd get jobs running
> every minute if the day of week and month match. And if they didn't
> match, you'd still get the job running if the time and day of month
> match.
>
> Also, in the tm struct, the day of the month (tm_mday) starts at 1,
> not the month (tm_mon).
Somewhat ironically, I'm (finally!) writing up release notes to do a
release, which means checking in stuff that's been lying around in my
tree, and I just did:
https://github.com/landley/toybox/commit/4ae60331b025
I fixed your patch up by hand to apply, but let me know if the result
works for you. (I haven't put together a crond test environment yet...)
Rob
More information about the Toybox
mailing list