use of org.joda.time.DateTimeZone in project joda-time-android by dlew.
the class TestDateTimeZone method testIsLocalDateTimeGap_NewYork.
//-----------------------------------------------------------------------
public void testIsLocalDateTimeGap_NewYork() {
DateTimeZone zone = DateTimeZone.forID("America/New_York");
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 1, 0)));
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 1, 59, 59, 99)));
assertEquals(true, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 2, 0)));
assertEquals(true, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 2, 30)));
assertEquals(true, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 2, 59, 59, 99)));
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 3, 0)));
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 3, 11, 4, 0)));
// before overlap
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 11, 4, 0, 30)));
// overlap
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 11, 4, 1, 30)));
// after overlap
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 11, 4, 2, 30)));
assertEquals(false, zone.isLocalDateTimeGap(new LocalDateTime(2007, 12, 24, 12, 34)));
}
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));
}
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());
}
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());
}
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);
}
Aggregations