Examples of toPeriod()


Examples of javax.time.calendar.ZoneOffset.toPeriod()

     */
    public Period getDaylightSavings(InstantProvider instantProvider) {
        Instant instant = Instant.instant(instantProvider);
        ZoneOffset standardOffset = getStandardOffset(instant);
        ZoneOffset actualOffset = getOffset(instant);
        return actualOffset.toPeriod().minus(standardOffset.toPeriod()).normalized();
    }

    /**
     * Gets the standard offset for the specified instant in this zone.
     * <p>
 
View Full Code Here

Examples of javax.time.calendar.ZoneOffset.toPeriod()

     */
    public Period getDaylightSavings(InstantProvider instantProvider) {
        Instant instant = Instant.from(instantProvider);
        ZoneOffset standardOffset = getStandardOffset(instant);
        ZoneOffset actualOffset = getOffset(instant);
        return actualOffset.toPeriod().minus(standardOffset.toPeriod()).normalized();
    }

    /**
     * Gets the standard offset for the specified instant in this zone.
     * <p>
 
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

    }

    private static void printScriptRunTime(DateTime startTime) {
        DateTime endTime = new DateTime();
        Duration duration = new Duration(startTime, endTime);
        Period period = duration.toPeriod().normalizedStandard(PeriodType.time());
        log.info("Pig script completed in "
                + PeriodFormat.getDefault().print(period)
                + " (" + duration.getMillis() + " ms)");
    }
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testOutOfOfficeHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 19, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 19, 21, 0, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT0S", elapsedTime.toPeriod().toString());
  }
 
  public void test247SLAA() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 19, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 19, 21, 0, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void test247SLAA() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 19, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 19, 21, 0, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.TWENTYFOUR_SEVEN_365);
    Assert.assertEquals("PT2H", elapsedTime.toPeriod().toString());
  }

  public void test247SLAB() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 19, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 26, 21, 5, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void test247SLAB() {
    DateTime lastCalculated = new DateTime(2009, 6, 19, 19, 0, 0, 0);
    DateTime now = new DateTime(2009, 6, 26, 21, 5, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.TWENTYFOUR_SEVEN_365);
    Assert.assertEquals("PT170H5M", elapsedTime.toPeriod().toString());
  }
 
  public void testStringToDurationConversion() {
   
    final String responseSLA = "PT8H30M";
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

      }
      duration = duration.plus(workingHours.toDuration());
      dateBeingProcessed = dateBeingProcessed.plusDays(1);
      processingInterval = getEntireDayIntervalForDate(dateBeingProcessed);
    }
    System.out.println(duration.toPeriod());
    return duration;
  }

  /**
   * Create an interval for an entire day
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testStartBeforeEndInWorkingHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 8, 55, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 12, 00, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT3H", elapsedTime.toPeriod().toString());
  }

  public void testStartBeforeEndAfterWorkingHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 8, 55, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 18, 00, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testStartBeforeEndAfterWorkingHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 8, 55, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 18, 00, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT8H30M", elapsedTime.toPeriod().toString());
  }

  public void testStartInEndInWorkingHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 14, 05, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 14, 17, 0, 0);
View Full Code Here

Examples of org.joda.time.Duration.toPeriod()

  public void testStartInEndInWorkingHours() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 14, 05, 0, 0);
    DateTime now = new DateTime(2009, 6, 22, 14, 17, 0, 0);

    Duration elapsedTime = calculator.calculateElapsedTime(lastCalculated, now, SLAWorkingHours.OFFICE_HOURS_9_TO_5_30);
    Assert.assertEquals("PT12M", elapsedTime.toPeriod().toString());
  }

  public void testSpanTwoDaysOfOfficHoursA() {
    DateTime lastCalculated = new DateTime(2009, 6, 22, 9, 5, 0, 0);
    DateTime now = new DateTime(2009, 6, 24, 9, 5, 0, 0);
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.