Search in sources :

Example 11 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class GregorianCalendarTest method test_computeTime_enteringDst_DelegatingTimeZone_LosAngeles_2014.

/**
     * This test will fail in the RI.
     *
     * <p>The AOSP behavior is different for backwards compatibility with previous versions of
     * Android.
     *
     * <p>Search in this file for 'OpenJDK Failure' to see more details.
     */
public void test_computeTime_enteringDst_DelegatingTimeZone_LosAngeles_2014() {
    TimeZone timeZone = TimeZone.getTimeZone("America/Los_Angeles");
    timeZone = new DelegatingTimeZone(timeZone);
    checkDstLosAngeles2014(timeZone);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 12 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class GregorianCalendarTest method checkOutsideDst.

private void checkOutsideDst(Calendar cal, String description) {
    TimeZone timeZone = cal.getTimeZone();
    checkOutsideDst(cal, description, timeZone.getRawOffset());
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 13 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class GregorianCalendarTest method checkInsideDst.

private void checkInsideDst(Calendar cal, String description) {
    TimeZone timeZone = cal.getTimeZone();
    checkDstFields(cal, description, timeZone.getRawOffset(), timeZone.getDSTSavings());
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 14 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class GregorianCalendarTest method test_computeTime_enteringDst_TimeZone_LosAngeles_2014.

public void test_computeTime_enteringDst_TimeZone_LosAngeles_2014() {
    TimeZone timeZone = TimeZone.getTimeZone("America/Los_Angeles");
    checkDstLosAngeles2014(timeZone);
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone)

Example 15 with TimeZone

use of java.util.TimeZone in project j2objc by google.

the class SimpleDateFormat method readObject.

/**
     * After reading an object from the input stream, the format
     * pattern in the object is verified.
     * <p>
     * @exception InvalidObjectException if the pattern is invalid
     */
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
    stream.defaultReadObject();
    try {
        compiledPattern = compile(pattern);
    } catch (Exception e) {
        throw new InvalidObjectException("invalid pattern");
    }
    if (serialVersionOnStream < 1) {
        // didn't have defaultCenturyStart field
        initializeDefaultCentury();
    } else {
        // fill in dependent transient field
        parseAmbiguousDatesAsAfter(defaultCenturyStart);
    }
    serialVersionOnStream = currentSerialVersion;
    // If the deserialized object has a SimpleTimeZone, try
    // to replace it with a ZoneInfo equivalent in order to
    // be compatible with the SimpleTimeZone-based
    // implementation as much as possible.
    TimeZone tz = getTimeZone();
    if (tz instanceof SimpleTimeZone) {
        String id = tz.getID();
        TimeZone zi = TimeZone.getTimeZone(id);
        if (zi != null && zi.hasSameRules(tz) && zi.getID().equals(id)) {
            setTimeZone(zi);
        }
    }
}
Also used : TimeZone(java.util.TimeZone) SimpleTimeZone(java.util.SimpleTimeZone) SimpleTimeZone(java.util.SimpleTimeZone) InvalidObjectException(java.io.InvalidObjectException) IOException(java.io.IOException) InvalidObjectException(java.io.InvalidObjectException)

Aggregations

TimeZone (java.util.TimeZone)577 Date (java.util.Date)140 Calendar (java.util.Calendar)137 SimpleTimeZone (java.util.SimpleTimeZone)89 Test (org.junit.Test)85 SimpleDateFormat (java.text.SimpleDateFormat)69 Locale (java.util.Locale)69 GregorianCalendar (java.util.GregorianCalendar)56 ArrayList (java.util.ArrayList)32 DateFormat (java.text.DateFormat)24 ParseException (java.text.ParseException)23 IOException (java.io.IOException)20 Map (java.util.Map)15 HashSet (java.util.HashSet)13 PreparedStatement (java.sql.PreparedStatement)11 HashMap (java.util.HashMap)11 DateTimeZone (org.joda.time.DateTimeZone)11 Support_TimeZone (tests.support.Support_TimeZone)10 Resources (android.content.res.Resources)9 SQLException (java.sql.SQLException)9