pycron
pycron copied to clipboard
time of next true condition
Hello,
Given a cron-style string, can pycron give the future closest time it will be true?
Thanks!
Hey,
this should be fairly easy to implement with a similar structure as pycron.has_been(), pull requests are welcome ;)
https://github.com/kipe/pycron/blob/master/pycron/init.py#L112
It would require some kind of "reasonable maximum iterations" though, so we wouldn't end up in an endless loop. Something like pycron.next(s, dt=None), if dt is None: dt = now() + timedelta(days=365) or so...
@kipe quick win but iterating over every step/minute dont look optimal, next and prev value should by calculated somehow not bruteforced.