Search in sources :

Example 11 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time-android by dlew.

the class TestDateTimeZone method testTransitionFixed.

//-----------------------------------------------------------------------
public void testTransitionFixed() {
    DateTimeZone zone = DateTimeZone.forID("+01:00");
    assertEquals(TEST_TIME_SUMMER, zone.nextTransition(TEST_TIME_SUMMER));
    assertEquals(TEST_TIME_WINTER, zone.nextTransition(TEST_TIME_WINTER));
    assertEquals(TEST_TIME_SUMMER, zone.previousTransition(TEST_TIME_SUMMER));
    assertEquals(TEST_TIME_WINTER, zone.previousTransition(TEST_TIME_WINTER));
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Example 12 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time-android by dlew.

the class TestDateTimeZone method testToTimeZone.

//-----------------------------------------------------------------------
public void testToTimeZone() {
    DateTimeZone zone = DateTimeZone.forID("Europe/Paris");
    TimeZone tz = zone.toTimeZone();
    assertEquals("Europe/Paris", tz.getID());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone) TimeZone(java.util.TimeZone) DateTimeZone(org.joda.time.DateTimeZone)

Example 13 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time-android by dlew.

the class TestDateTimeZone method testIsFixed.

//-----------------------------------------------------------------------
public void testIsFixed() {
    DateTimeZone zone = DateTimeZone.forID("Europe/Paris");
    assertEquals(false, zone.isFixed());
    assertEquals(true, DateTimeZone.UTC.isFixed());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Example 14 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time-android by dlew.

the class ResourceZoneInfoProvider method getZone.

//-----------------------------------------------------------------------
/**
     * If an error is thrown while loading zone data, the exception is logged
     * to system error and null is returned for this and all future requests.
     *
     * @param id  the id to load
     * @return the loaded zone
     */
public DateTimeZone getZone(String id) {
    if (id == null) {
        return null;
    }
    Object obj = iZoneInfoMap.get(id);
    if (obj == null) {
        return null;
    }
    if (id.equals(obj)) {
        // Load zone data for the first time.
        return loadZoneData(id);
    }
    if (obj instanceof SoftReference<?>) {
        @SuppressWarnings("unchecked") SoftReference<DateTimeZone> ref = (SoftReference<DateTimeZone>) obj;
        DateTimeZone tz = ref.get();
        if (tz != null) {
            return tz;
        }
        // Reference cleared; load data again.
        return loadZoneData(id);
    }
    // If this point is reached, mapping must link to another.
    return getZone((String) obj);
}
Also used : SoftReference(java.lang.ref.SoftReference) DateTimeZone(org.joda.time.DateTimeZone)

Example 15 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time-android by dlew.

the class TestDateTimeZone method testGetNameKey.

public void testGetNameKey() {
    DateTimeZone zone = DateTimeZone.forID("Europe/London");
    assertEquals("BST", zone.getNameKey(TEST_TIME_SUMMER));
    assertEquals("GMT", zone.getNameKey(TEST_TIME_WINTER));
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Aggregations

DateTimeZone (org.joda.time.DateTimeZone)263 DateTime (org.joda.time.DateTime)123 ArrayList (java.util.ArrayList)36 Test (org.testng.annotations.Test)35 LocalDate (org.joda.time.LocalDate)27 Test (org.junit.Test)21 TimeIntervalRounding (org.elasticsearch.common.rounding.Rounding.TimeIntervalRounding)18 TimeUnitRounding (org.elasticsearch.common.rounding.Rounding.TimeUnitRounding)18 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)17 IOException (java.io.IOException)16 HashMap (java.util.HashMap)15 UUID (java.util.UUID)14 TimeFormat (org.gephi.graph.api.TimeFormat)13 MetricExpression (com.linkedin.thirdeye.client.MetricExpression)12 Date (java.util.Date)12 Chronology (org.joda.time.Chronology)12 LocalDateTime (org.joda.time.LocalDateTime)12 DefaultBlockingState (org.killbill.billing.junction.DefaultBlockingState)11 LocalTime (org.joda.time.LocalTime)10 SubscriptionBaseTransition (org.killbill.billing.subscription.api.user.SubscriptionBaseTransition)10