[Jcrontab-developers] Cron.java
Brought to you by:
iolalla
From: Erik L. <Eri...@la...> - 2006-12-22 15:13:16
|
In the method generateTasks() in Cron.java (v. 1.57) you have these lines: // Rounds the calendar to the previous minute Calendar cal = Calendar.getInstance(); cal.setTime(new Date((System.currentTimeMillis()))); But this will not round to previous minute, actually the second code line is redundant. To fix you could do something similar to what is done later in a catch block: Calendar cal = Calendar.getInstance(); cal.setTime(new Date(((long)(System.currentTimeMillis() / 60000))* 60000)); This would remove everything below minutes from the calendar. To actually get the previous minute just remove one minute from the calendar (don't know if this is actually what's intended). I would also suggest moving the creation of the calendar above the creation of the task list. As it is now if the DB access takes long enough you could get a calendar that is later then intended (although this should probably not be a problem if the rounding above is fixed). Regards, Erik |