Examples of DateTimeZone


Examples of org.joda.time.DateTimeZone

            }
        }
    }

    public void testReverseTransitions() {
        DateTimeZone tz = buildAmericaLosAngeles();
        testReverseTransitions(tz, AMERICA_LOS_ANGELES_DATA);
    }
View Full Code Here

Examples of org.joda.time.DateTimeZone

            assertEquals(expectedOffset, tz.getOffset(instant));
        }
    }

    public void testSerialization() throws IOException {
        DateTimeZone tz = testSerialization
            (buildAmericaLosAngelesBuilder(), "America/Los_Angeles");

        assertEquals(false, tz.isFixed());
        testForwardTransitions(tz, AMERICA_LOS_ANGELES_DATA);
        testReverseTransitions(tz, AMERICA_LOS_ANGELES_DATA);
    }
View Full Code Here

Examples of org.joda.time.DateTimeZone

        throws IOException
    {
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        builder.writeTo("America/Los_Angeles", out);
        ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
        DateTimeZone tz = DateTimeZoneBuilder.readFrom(in, id);
        assertEquals(id, tz.getID());
        return tz;
    }
View Full Code Here

Examples of org.joda.time.DateTimeZone

    public void testFixed() throws IOException {
        DateTimeZoneBuilder builder = new DateTimeZoneBuilder()
            .setStandardOffset(3600000)
            .setFixedSavings("LMT", 0);
        DateTimeZone tz = builder.toDateTimeZone("Test", true);

        for (int i=0; i<2; i++) {
            assertEquals("Test", tz.getID());
            assertEquals(true, tz.isFixed());
            assertEquals(3600000, tz.getOffset(0));
            assertEquals(3600000, tz.getStandardOffset(0));
            assertEquals(0, tz.nextTransition(0));
            assertEquals(0, tz.previousTransition(0));

            tz = testSerialization(builder, "Test");
        }
    }
View Full Code Here

Examples of org.joda.time.DateTimeZone

        System.out.println("Writing zoneinfo files");
        for (int i=0; i<iZones.size(); i++) {
            Zone zone = iZones.get(i);
            DateTimeZoneBuilder builder = new DateTimeZoneBuilder();
            zone.addToBuilder(builder, iRuleSets);
            final DateTimeZone original = builder.toDateTimeZone(zone.iName, true);
            DateTimeZone tz = original;
            if (test(tz.getID(), tz)) {
                map.put(tz.getID(), tz);
                if (outputDir != null) {
                    if (ZoneInfoCompiler.verbose()) {
                        System.out.println("Writing " + tz.getID());
                    }
                    File file = new File(outputDir, tz.getID());
                    if (!file.getParentFile().exists()) {
                        file.getParentFile().mkdirs();
                    }
                    OutputStream out = new FileOutputStream(file);
                    try {
                        builder.writeTo(zone.iName, out);
                    } finally {
                        out.close();
                    }

                    // Test if it can be read back.
                    InputStream in = new FileInputStream(file);
                    DateTimeZone tz2 = DateTimeZoneBuilder.readFrom(in, tz.getID());
                    in.close();

                    if (!original.equals(tz2)) {
                        System.out.println("*e* Error in " + tz.getID() +
                                           ": Didn't read properly from file");
                    }
                }
            }
        }

        for (int pass=0; pass<2; pass++) {
            for (int i=0; i<iLinks.size(); i += 2) {
                String id = iLinks.get(i);
                String alias = iLinks.get(i + 1);
                DateTimeZone tz = map.get(id);
                if (tz == null) {
                    if (pass > 0) {
                        System.out.println("Cannot find time zone '" + id +
                                           "' to link alias '" + alias + "' to");
                    }
View Full Code Here

Examples of org.joda.time.DateTimeZone

        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());
View Full Code Here

Examples of org.joda.time.DateTimeZone

        assertEquals(true, buddhistUTC.hours().isPrecise());
        assertEquals(true, buddhistUTC.minutes().isPrecise());
        assertEquals(true, buddhistUTC.seconds().isPrecise());
        assertEquals(true, buddhistUTC.millis().isPrecise());
       
        final DateTimeZone gmt = DateTimeZone.forID("Etc/GMT");
        final BuddhistChronology buddhistGMT = BuddhistChronology.getInstance(gmt);
        assertEquals(false, buddhistGMT.centuries().isPrecise());
        assertEquals(false, buddhistGMT.years().isPrecise());
        assertEquals(false, buddhistGMT.weekyears().isPrecise());
        assertEquals(false, buddhistGMT.months().isPrecise());
View Full Code Here

Examples of org.joda.time.DateTimeZone

        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());
View Full Code Here

Examples of org.joda.time.DateTimeZone

        } else {
            try {
                if (cr.timezone.isEmpty()) {
                    user.setTimeZone((String)null);
                } else {
                    final DateTimeZone tz = DateTimeZone.forID(cr.timezone);
                    user.setTimeZone(tz);
                }
            } catch (IllegalArgumentException e) {
                LOG.error("Invalid timezone '{}', ignoring it for user {}.", cr.timezone, username);
            }
View Full Code Here

Examples of org.joda.time.DateTimeZone

                boolean readonly,
                boolean external,
                Startpage startpage,
                long sessionTimeoutMs,
                Map<String, Object> preferences) {
        DateTimeZone timezone1 = null;
        this.sessionTimeoutMs = sessionTimeoutMs;
        this.api = api;
        this.id = id;
        this.name = name;
    this.email = email;
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.