Search in sources :

Example 96 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time by JodaOrg.

the class TestCopticChronology method testDurationFields.

//-----------------------------------------------------------------------
public void testDurationFields() {
    final CopticChronology coptic = CopticChronology.getInstance();
    assertEquals("eras", coptic.eras().getName());
    assertEquals("centuries", coptic.centuries().getName());
    assertEquals("years", coptic.years().getName());
    assertEquals("weekyears", coptic.weekyears().getName());
    assertEquals("months", coptic.months().getName());
    assertEquals("weeks", coptic.weeks().getName());
    assertEquals("days", coptic.days().getName());
    assertEquals("halfdays", coptic.halfdays().getName());
    assertEquals("hours", coptic.hours().getName());
    assertEquals("minutes", coptic.minutes().getName());
    assertEquals("seconds", coptic.seconds().getName());
    assertEquals("millis", coptic.millis().getName());
    assertEquals(false, coptic.eras().isSupported());
    assertEquals(true, coptic.centuries().isSupported());
    assertEquals(true, coptic.years().isSupported());
    assertEquals(true, coptic.weekyears().isSupported());
    assertEquals(true, coptic.months().isSupported());
    assertEquals(true, coptic.weeks().isSupported());
    assertEquals(true, coptic.days().isSupported());
    assertEquals(true, coptic.halfdays().isSupported());
    assertEquals(true, coptic.hours().isSupported());
    assertEquals(true, coptic.minutes().isSupported());
    assertEquals(true, coptic.seconds().isSupported());
    assertEquals(true, coptic.millis().isSupported());
    assertEquals(false, coptic.centuries().isPrecise());
    assertEquals(false, coptic.years().isPrecise());
    assertEquals(false, coptic.weekyears().isPrecise());
    assertEquals(false, coptic.months().isPrecise());
    assertEquals(false, coptic.weeks().isPrecise());
    assertEquals(false, coptic.days().isPrecise());
    assertEquals(false, coptic.halfdays().isPrecise());
    assertEquals(true, coptic.hours().isPrecise());
    assertEquals(true, coptic.minutes().isPrecise());
    assertEquals(true, coptic.seconds().isPrecise());
    assertEquals(true, coptic.millis().isPrecise());
    final CopticChronology copticUTC = CopticChronology.getInstanceUTC();
    assertEquals(false, copticUTC.centuries().isPrecise());
    assertEquals(false, copticUTC.years().isPrecise());
    assertEquals(false, copticUTC.weekyears().isPrecise());
    assertEquals(false, copticUTC.months().isPrecise());
    assertEquals(true, copticUTC.weeks().isPrecise());
    assertEquals(true, copticUTC.days().isPrecise());
    assertEquals(true, copticUTC.halfdays().isPrecise());
    assertEquals(true, copticUTC.hours().isPrecise());
    assertEquals(true, copticUTC.minutes().isPrecise());
    assertEquals(true, copticUTC.seconds().isPrecise());
    assertEquals(true, copticUTC.millis().isPrecise());
    final DateTimeZone gmt = DateTimeZone.forID("Etc/GMT");
    final CopticChronology copticGMT = CopticChronology.getInstance(gmt);
    assertEquals(false, copticGMT.centuries().isPrecise());
    assertEquals(false, copticGMT.years().isPrecise());
    assertEquals(false, copticGMT.weekyears().isPrecise());
    assertEquals(false, copticGMT.months().isPrecise());
    assertEquals(true, copticGMT.weeks().isPrecise());
    assertEquals(true, copticGMT.days().isPrecise());
    assertEquals(true, copticGMT.halfdays().isPrecise());
    assertEquals(true, copticGMT.hours().isPrecise());
    assertEquals(true, copticGMT.minutes().isPrecise());
    assertEquals(true, copticGMT.seconds().isPrecise());
    assertEquals(true, copticGMT.millis().isPrecise());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Example 97 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time by JodaOrg.

the class TestGregorianChronology method testDurationFields.

//-----------------------------------------------------------------------
public void testDurationFields() {
    final GregorianChronology greg = GregorianChronology.getInstance();
    assertEquals("eras", greg.eras().getName());
    assertEquals("centuries", greg.centuries().getName());
    assertEquals("years", greg.years().getName());
    assertEquals("weekyears", greg.weekyears().getName());
    assertEquals("months", greg.months().getName());
    assertEquals("weeks", greg.weeks().getName());
    assertEquals("days", greg.days().getName());
    assertEquals("halfdays", greg.halfdays().getName());
    assertEquals("hours", greg.hours().getName());
    assertEquals("minutes", greg.minutes().getName());
    assertEquals("seconds", greg.seconds().getName());
    assertEquals("millis", greg.millis().getName());
    assertEquals(false, greg.eras().isSupported());
    assertEquals(true, greg.centuries().isSupported());
    assertEquals(true, greg.years().isSupported());
    assertEquals(true, greg.weekyears().isSupported());
    assertEquals(true, greg.months().isSupported());
    assertEquals(true, greg.weeks().isSupported());
    assertEquals(true, greg.days().isSupported());
    assertEquals(true, greg.halfdays().isSupported());
    assertEquals(true, greg.hours().isSupported());
    assertEquals(true, greg.minutes().isSupported());
    assertEquals(true, greg.seconds().isSupported());
    assertEquals(true, greg.millis().isSupported());
    assertEquals(false, greg.centuries().isPrecise());
    assertEquals(false, greg.years().isPrecise());
    assertEquals(false, greg.weekyears().isPrecise());
    assertEquals(false, greg.months().isPrecise());
    assertEquals(false, greg.weeks().isPrecise());
    assertEquals(false, greg.days().isPrecise());
    assertEquals(false, greg.halfdays().isPrecise());
    assertEquals(true, greg.hours().isPrecise());
    assertEquals(true, greg.minutes().isPrecise());
    assertEquals(true, greg.seconds().isPrecise());
    assertEquals(true, greg.millis().isPrecise());
    final GregorianChronology gregUTC = GregorianChronology.getInstanceUTC();
    assertEquals(false, gregUTC.centuries().isPrecise());
    assertEquals(false, gregUTC.years().isPrecise());
    assertEquals(false, gregUTC.weekyears().isPrecise());
    assertEquals(false, gregUTC.months().isPrecise());
    assertEquals(true, gregUTC.weeks().isPrecise());
    assertEquals(true, gregUTC.days().isPrecise());
    assertEquals(true, gregUTC.halfdays().isPrecise());
    assertEquals(true, gregUTC.hours().isPrecise());
    assertEquals(true, gregUTC.minutes().isPrecise());
    assertEquals(true, gregUTC.seconds().isPrecise());
    assertEquals(true, gregUTC.millis().isPrecise());
    final DateTimeZone gmt = DateTimeZone.forID("Etc/GMT");
    final GregorianChronology gregGMT = GregorianChronology.getInstance(gmt);
    assertEquals(false, gregGMT.centuries().isPrecise());
    assertEquals(false, gregGMT.years().isPrecise());
    assertEquals(false, gregGMT.weekyears().isPrecise());
    assertEquals(false, gregGMT.months().isPrecise());
    assertEquals(true, gregGMT.weeks().isPrecise());
    assertEquals(true, gregGMT.days().isPrecise());
    assertEquals(true, gregGMT.halfdays().isPrecise());
    assertEquals(true, gregGMT.hours().isPrecise());
    assertEquals(true, gregGMT.minutes().isPrecise());
    assertEquals(true, gregGMT.seconds().isPrecise());
    assertEquals(true, gregGMT.millis().isPrecise());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Example 98 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time by JodaOrg.

the class TestISOChronology method testDurationFields.

//-----------------------------------------------------------------------
public void testDurationFields() {
    final ISOChronology iso = ISOChronology.getInstance();
    assertEquals("eras", iso.eras().getName());
    assertEquals("centuries", iso.centuries().getName());
    assertEquals("years", iso.years().getName());
    assertEquals("weekyears", iso.weekyears().getName());
    assertEquals("months", iso.months().getName());
    assertEquals("weeks", iso.weeks().getName());
    assertEquals("days", iso.days().getName());
    assertEquals("halfdays", iso.halfdays().getName());
    assertEquals("hours", iso.hours().getName());
    assertEquals("minutes", iso.minutes().getName());
    assertEquals("seconds", iso.seconds().getName());
    assertEquals("millis", iso.millis().getName());
    assertEquals(false, iso.eras().isSupported());
    assertEquals(true, iso.centuries().isSupported());
    assertEquals(true, iso.years().isSupported());
    assertEquals(true, iso.weekyears().isSupported());
    assertEquals(true, iso.months().isSupported());
    assertEquals(true, iso.weeks().isSupported());
    assertEquals(true, iso.days().isSupported());
    assertEquals(true, iso.halfdays().isSupported());
    assertEquals(true, iso.hours().isSupported());
    assertEquals(true, iso.minutes().isSupported());
    assertEquals(true, iso.seconds().isSupported());
    assertEquals(true, iso.millis().isSupported());
    assertEquals(false, iso.centuries().isPrecise());
    assertEquals(false, iso.years().isPrecise());
    assertEquals(false, iso.weekyears().isPrecise());
    assertEquals(false, iso.months().isPrecise());
    assertEquals(false, iso.weeks().isPrecise());
    assertEquals(false, iso.days().isPrecise());
    assertEquals(false, iso.halfdays().isPrecise());
    assertEquals(true, iso.hours().isPrecise());
    assertEquals(true, iso.minutes().isPrecise());
    assertEquals(true, iso.seconds().isPrecise());
    assertEquals(true, iso.millis().isPrecise());
    final ISOChronology isoUTC = ISOChronology.getInstanceUTC();
    assertEquals(false, isoUTC.centuries().isPrecise());
    assertEquals(false, isoUTC.years().isPrecise());
    assertEquals(false, isoUTC.weekyears().isPrecise());
    assertEquals(false, isoUTC.months().isPrecise());
    assertEquals(true, isoUTC.weeks().isPrecise());
    assertEquals(true, isoUTC.days().isPrecise());
    assertEquals(true, isoUTC.halfdays().isPrecise());
    assertEquals(true, isoUTC.hours().isPrecise());
    assertEquals(true, isoUTC.minutes().isPrecise());
    assertEquals(true, isoUTC.seconds().isPrecise());
    assertEquals(true, isoUTC.millis().isPrecise());
    final DateTimeZone gmt = DateTimeZone.forID("Etc/GMT");
    final ISOChronology isoGMT = ISOChronology.getInstance(gmt);
    assertEquals(false, isoGMT.centuries().isPrecise());
    assertEquals(false, isoGMT.years().isPrecise());
    assertEquals(false, isoGMT.weekyears().isPrecise());
    assertEquals(false, isoGMT.months().isPrecise());
    assertEquals(true, isoGMT.weeks().isPrecise());
    assertEquals(true, isoGMT.days().isPrecise());
    assertEquals(true, isoGMT.halfdays().isPrecise());
    assertEquals(true, isoGMT.hours().isPrecise());
    assertEquals(true, isoGMT.minutes().isPrecise());
    assertEquals(true, isoGMT.seconds().isPrecise());
    assertEquals(true, isoGMT.millis().isPrecise());
    final DateTimeZone offset = DateTimeZone.forOffsetHours(1);
    final ISOChronology isoOffset1 = ISOChronology.getInstance(offset);
    assertEquals(false, isoOffset1.centuries().isPrecise());
    assertEquals(false, isoOffset1.years().isPrecise());
    assertEquals(false, isoOffset1.weekyears().isPrecise());
    assertEquals(false, isoOffset1.months().isPrecise());
    assertEquals(true, isoOffset1.weeks().isPrecise());
    assertEquals(true, isoOffset1.days().isPrecise());
    assertEquals(true, isoOffset1.halfdays().isPrecise());
    assertEquals(true, isoOffset1.hours().isPrecise());
    assertEquals(true, isoOffset1.minutes().isPrecise());
    assertEquals(true, isoOffset1.seconds().isPrecise());
    assertEquals(true, isoOffset1.millis().isPrecise());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Example 99 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time by JodaOrg.

the class TestGJChronology method testDurationFields.

//-----------------------------------------------------------------------
public void testDurationFields() {
    final GJChronology gj = GJChronology.getInstance();
    assertEquals("eras", gj.eras().getName());
    assertEquals("centuries", gj.centuries().getName());
    assertEquals("years", gj.years().getName());
    assertEquals("weekyears", gj.weekyears().getName());
    assertEquals("months", gj.months().getName());
    assertEquals("weeks", gj.weeks().getName());
    assertEquals("halfdays", gj.halfdays().getName());
    assertEquals("days", gj.days().getName());
    assertEquals("hours", gj.hours().getName());
    assertEquals("minutes", gj.minutes().getName());
    assertEquals("seconds", gj.seconds().getName());
    assertEquals("millis", gj.millis().getName());
    assertEquals(false, gj.eras().isSupported());
    assertEquals(true, gj.centuries().isSupported());
    assertEquals(true, gj.years().isSupported());
    assertEquals(true, gj.weekyears().isSupported());
    assertEquals(true, gj.months().isSupported());
    assertEquals(true, gj.weeks().isSupported());
    assertEquals(true, gj.days().isSupported());
    assertEquals(true, gj.halfdays().isSupported());
    assertEquals(true, gj.hours().isSupported());
    assertEquals(true, gj.minutes().isSupported());
    assertEquals(true, gj.seconds().isSupported());
    assertEquals(true, gj.millis().isSupported());
    assertEquals(false, gj.centuries().isPrecise());
    assertEquals(false, gj.years().isPrecise());
    assertEquals(false, gj.weekyears().isPrecise());
    assertEquals(false, gj.months().isPrecise());
    assertEquals(false, gj.weeks().isPrecise());
    assertEquals(false, gj.days().isPrecise());
    assertEquals(false, gj.halfdays().isPrecise());
    assertEquals(true, gj.hours().isPrecise());
    assertEquals(true, gj.minutes().isPrecise());
    assertEquals(true, gj.seconds().isPrecise());
    assertEquals(true, gj.millis().isPrecise());
    final GJChronology gjUTC = GJChronology.getInstanceUTC();
    assertEquals(false, gjUTC.centuries().isPrecise());
    assertEquals(false, gjUTC.years().isPrecise());
    assertEquals(false, gjUTC.weekyears().isPrecise());
    assertEquals(false, gjUTC.months().isPrecise());
    assertEquals(true, gjUTC.weeks().isPrecise());
    assertEquals(true, gjUTC.days().isPrecise());
    assertEquals(true, gjUTC.halfdays().isPrecise());
    assertEquals(true, gjUTC.hours().isPrecise());
    assertEquals(true, gjUTC.minutes().isPrecise());
    assertEquals(true, gjUTC.seconds().isPrecise());
    assertEquals(true, gjUTC.millis().isPrecise());
    final DateTimeZone gmt = DateTimeZone.forID("Etc/GMT");
    final GJChronology gjGMT = GJChronology.getInstance(gmt);
    assertEquals(false, gjGMT.centuries().isPrecise());
    assertEquals(false, gjGMT.years().isPrecise());
    assertEquals(false, gjGMT.weekyears().isPrecise());
    assertEquals(false, gjGMT.months().isPrecise());
    assertEquals(true, gjGMT.weeks().isPrecise());
    assertEquals(true, gjGMT.days().isPrecise());
    assertEquals(true, gjGMT.halfdays().isPrecise());
    assertEquals(true, gjGMT.hours().isPrecise());
    assertEquals(true, gjGMT.minutes().isPrecise());
    assertEquals(true, gjGMT.seconds().isPrecise());
    assertEquals(true, gjGMT.millis().isPrecise());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone)

Example 100 with DateTimeZone

use of org.joda.time.DateTimeZone in project joda-time by JodaOrg.

the class TestCompiler method test_Amman_2003.

public void test_Amman_2003() {
    DateTimeZone zone = DateTimeZone.forID("Asia/Amman");
    DateTime dt = new DateTime(2003, 3, 1, 0, 0, zone);
    long next = zone.nextTransition(dt.getMillis());
    assertEquals(next, new DateTime(2003, 3, 28, 0, 0, DateTimeZone.forOffsetHours(2)).getMillis());
}
Also used : DateTimeZone(org.joda.time.DateTimeZone) DateTime(org.joda.time.DateTime)

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