Exemple #1
0
  /** 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());
  }
Exemple #2
0
  /** 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;
  }