ScheduleConfig: compute delay without using loops

Also make the computation of the delay for the case "start < now"
consistent with the case "now < start" i.e. make sure that the
computed delay is never zero.

Change-Id: I807637fdaf209f8a3b7e7a04d3504809ee591a07
This commit is contained in:
Saša Živkov
2014-06-27 18:11:27 +02:00
parent 4f25970538
commit ce68f29c9a
2 changed files with 10 additions and 12 deletions

View File

@@ -53,7 +53,7 @@ public class ScheduleConfigTest {
assertEquals(ms(1, HOURS), initialDelay("Mon 11:00", "1d"));
assertEquals(ms(23, HOURS), initialDelay("Mon 09:00", "1d"));
assertEquals(0, initialDelay("Mon 10:00", "1d"));
assertEquals(ms(1, DAYS), initialDelay("Mon 10:00", "1d"));
}
private static long initialDelay(String startTime, String interval)