taichino / croniter

croniter is a python module to provide iteration for datetime object.
http://github.com/taichino/croniter
387 stars 105 forks source link

croniter 6th param should be year but it's seconds. #176

Closed HaloKo4 closed 3 years ago

HaloKo4 commented 3 years ago

https://github.com/taichino/croniter/issues/76 is closed but it's not resolved. In that issue itself there are several examples where the 6th param means seconds when it should be years I'm copying it here:

base = datetime(2010, 1, 25, 4, 46)
iter = croniter('* * * * * */5', base)
print(iter.get_next(datetime))
print(iter.get_next(datetime))
print(iter.get_next(datetime))

Prints:

2010-01-25 04:46:05
2010-01-25 04:46:10
2010-01-25 04:46:15

Also see discussion in Apache Airflow https://github.com/apache/airflow/issues/16107 pointing to another reproduce example on https://github.com/apache/airflow/issues/16107#issuecomment-871215170

kiorky commented 3 years ago

wait that was contributed a long time ago and was related to seconds repeatitions, and not part of any official spec.

croniter mostly sticks with the original 5fields cron format with some variations.

There are some bits with 6fields (seconds): https://github.com/taichino/croniter#about-second-repeats but not a full support.

PR are welcomes ;-)

kiorky commented 3 years ago

closing as a reopening of the former bug that i mis read.