Package org.joda.time

Examples of org.joda.time.DateTime.minus()


    DateTime lastShouldRun = monitor.getLastShouldHaveRun();
    DateTime nextRun = lastShouldRun.plus(timePeriod);
    if(log.isDebugEnabled())
      log.debug("nextRun="+nextRun+" now="+now+" lastShouldRun="+lastShouldRun);
    if(now.isAfter(nextRun.minus(1000))) {
      monitor.setLastShouldHaveRun(nextRun);
      return true;
    }
    return false;
  }
View Full Code Here


    if (start == null) {
      start = new DateTime();
    }
    this.heartBeats++;
    DateTime now = new DateTime();
    long secondsPast = now.minus(start.getMillis()).getMillis() / 1000;
    double heartBeatsPerSecond = heartBeats / (secondsPast == 0 ? 1 : secondsPast);
    if (logging) {
      System.out.println("heartBeats: " + heartBeats);
      System.out.println("duration:" + secondsPast);
      System.out.println("heartBeatsPerSecond:" + heartBeatsPerSecond);
View Full Code Here

        DateTime start = aroundInstant.minus(period);
        DateTime end = aroundInstant.plus(period);
        Interval range = new Interval(start, end);
        DateTime middleOf = IntervalUtils.middleOf(range);
        long halfRange = range.toDurationMillis() / 4;
        final Interval newInterval = new Interval(middleOf.minus(halfRange), middleOf.plus(halfRange));
        return newInterval;
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.