我可能只是个白痴-这是漫长的一天!我在第一次涉足 Quartz 时误解了一些东西......
鉴于此代码:
DateTime dt = new DateTime();
dt = dt.withDayOfMonth(20);
Calendar cal = new CronCalendar("0 0/10 * * * ?" );
long start = dt.getMillis();
System.out.println("Starting at " + start);
long end = start + 10;
long current = start;
int i = 0;
while (current < end) {
if (i > 0) {
System.out.println(i + ":" + current);
}
long next = cal.getNextIncludedTime(current);
current = next;
i++;
}
我希望输出中最多包含一个时间,因为时间窗口是 10 毫秒,而日历中包含的时间相隔 10 分钟。
但是当我运行它时:
Starting at 1250796103004
1:1250796103005
2:1250796103006
3:1250796103007
4:1250796103008
5:1250796103009
6:1250796103010
7:1250796103011
8:1250796103012
9:1250796103013
请帮忙!