jmrozanec / cron-utils

Cron utils for parsing, validations and human readable descriptions as well as date/time interoperability.
http://cron-utils.com
Apache License 2.0
1.15k stars 262 forks source link

Incorrect executionTime #631

Open sunshine7690 opened 1 month ago

sunshine7690 commented 1 month ago

public static void main(String[] args) { CronDefinition definition = CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ); CronParser parser = new CronParser(definition); Cron cron = parser.parse("/8 * ?"); ExecutionTime executionTime = ExecutionTime.forCron(cron); ZonedDateTime now = ZonedDateTime.of(2024, 9, 12, 10, 46, 57, 0, ZoneOffset.UTC); System.out.println("now "+now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); now = executionTime.nextExecution(now).get(); System.out.println(" nextExecution "+ now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); }

Run the code. result is: now 2024-09-12 10:46:57 nextExecution 2024-09-12 10:47:00

During cross-minute, the next execution time is incorrect.