/** Count of triggers since schedule. */ public int getTriggerCountSinceSchedule() { long now = System.currentTimeMillis(); long initTriggerTime = options.getTriggerTime(); if (!wasInThePast()) return 0; if (!isRepeating()) return 1; return (int) ((now - initTriggerTime) / options.getRepeatInterval()); }
/** Next trigger time. */ public long getNextTriggerTime() { long triggerTime = options.getTriggerTime(); if (!isRepeating() || !isTriggered()) return triggerTime; long interval = options.getRepeatInterval(); int triggerCount = getTriggerCountSinceSchedule(); return triggerTime + (triggerCount + 1) * interval; }