[
quoting the contents at those links for your reading convenience here:
my original question:
So I'm seeing this weird thing (or at least, weird to me, with my tiny amount of experience).
cronnext tells me the nextstring for an every-minute cronjob is the beginning of the current minute,
ie in the past.
eg, if I run cronnext at 02:11:27,
it says: nextstring: Tue Jul 25 02:11:00 2023
(
rather than (as I'd naively expect): nextstring: Tue Jul 25 02:12:00 2023
)
Is this normal, or...?
Cuz I couldn't find anything about it in any of the manpages,
and I haven't been able to google anything up with the terms that I've been able to think of...
I added the anacron tag too,
cuz I do have it installed,
although I never used it directly,
so I don't know if it's relevant.
(
I've already tracked down and fixed the bug I was originally trying to fix when I came across this,
so it turned out to just be a red-herring on that particular issue,
but I decided I still want to ask about it, cuz it still seems weird to me.
)
The answer that made me come here:
The tool doesn't exist on Debian so I downloaded the latest version, cronie-1.6.1 from its source repository on Github.
The manpage writes in the DESCRIPTION,
Determine the time cron will execute the next job. Without arguments, it prints that time considering all crontabs, in number of seconds since the Epoch, rounded to the minute.
(My emphasis.) It appears that the code always rounds down, which generates incorrect answers such as that which you've found.
A fix appears to be to change the loop starting condition on line 250 of src/cronnext.c that calls nextmatch() to use start+60 rather than start. However, I'm not confident enough of this to submit a patch, and I suspect that fixing start by adding 60 (seconds) where it's defined on line 344 rather than when it's used would be better.
Since you use the program, it would be best if you were to submit a bug report on the issue tracker.
]
(And to be clear, yes, it rounds down even when the seconds are above "MM:55" or whatever.)
[ $
cron -V
#=>cronie 1.6.1
openSUSE Tumbleweed 20230724
]I just asked: https://unix.stackexchange.com/q/752394/571754
and was told: https://unix.stackexchange.com/a/752405/571754 it sounded like a bug, and I should make a submission here.
[ quoting the contents at those links for your reading convenience here: my original question:
The answer that made me come here:
(And to be clear, yes, it rounds down even when the seconds are above "MM:55" or whatever.)