mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Adds initial implementations of date-relates classes
This commit is contained in:
parent
2e5cdc109b
commit
2817f7603d
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,814 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.teavm.classlib.java.util;
|
||||||
|
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.DateFormatSymbols;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import org.teavm.classlib.java.io.TSerializable;
|
||||||
|
import org.teavm.classlib.java.lang.TCloneable;
|
||||||
|
import org.teavm.classlib.java.lang.TComparable;
|
||||||
|
|
||||||
|
public class Date implements TSerializable, TCloneable, TComparable<Date> {
|
||||||
|
|
||||||
|
// Used by parse()
|
||||||
|
private static int creationYear = new Date().getYear();
|
||||||
|
|
||||||
|
private transient long milliseconds;
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private static String[] dayOfWeekNames = { "Sun", "Mon", "Tue", "Wed",
|
||||||
|
"Thu", "Fri", "Sat" };
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
private static String[] monthNames = { "Jan", "Feb", "Mar", "Apr", "May",
|
||||||
|
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes this {@code Date} instance to the current date and time.
|
||||||
|
*/
|
||||||
|
public Date() {
|
||||||
|
this(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code Date} initialized to midnight in the default {@code TimeZone} on
|
||||||
|
* the specified date.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* the year, 0 is 1900.
|
||||||
|
* @param month
|
||||||
|
* the month, 0 - 11.
|
||||||
|
* @param day
|
||||||
|
* the day of the month, 1 - 31.
|
||||||
|
*
|
||||||
|
* @deprecated use
|
||||||
|
* {@link GregorianCalendar#GregorianCalendar(int, int, int)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Date(int year, int month, int day) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(false);
|
||||||
|
cal.set(1900 + year, month, day);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code Date} initialized to the specified date and time in the
|
||||||
|
* default {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* the year, 0 is 1900.
|
||||||
|
* @param month
|
||||||
|
* the month, 0 - 11.
|
||||||
|
* @param day
|
||||||
|
* the day of the month, 1 - 31.
|
||||||
|
* @param hour
|
||||||
|
* the hour of day, 0 - 23.
|
||||||
|
* @param minute
|
||||||
|
* the minute of the hour, 0 - 59.
|
||||||
|
*
|
||||||
|
* @deprecated use
|
||||||
|
* {@link GregorianCalendar#GregorianCalendar(int, int, int, int, int)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Date(int year, int month, int day, int hour, int minute) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(false);
|
||||||
|
cal.set(1900 + year, month, day, hour, minute);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code Date} initialized to the specified date and time in the
|
||||||
|
* default {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* the year, 0 is 1900.
|
||||||
|
* @param month
|
||||||
|
* the month, 0 - 11.
|
||||||
|
* @param day
|
||||||
|
* the day of the month, 1 - 31.
|
||||||
|
* @param hour
|
||||||
|
* the hour of day, 0 - 23.
|
||||||
|
* @param minute
|
||||||
|
* the minute of the hour, 0 - 59.
|
||||||
|
* @param second
|
||||||
|
* the second of the minute, 0 - 59.
|
||||||
|
*
|
||||||
|
* @deprecated use
|
||||||
|
* {@link GregorianCalendar#GregorianCalendar(int, int, int, int, int, int)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Date(int year, int month, int day, int hour, int minute, int second) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(false);
|
||||||
|
cal.set(1900 + year, month, day, hour, minute, second);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes this {@code Date} instance using the specified millisecond value. The
|
||||||
|
* value is the number of milliseconds since Jan. 1, 1970 GMT.
|
||||||
|
*
|
||||||
|
* @param milliseconds
|
||||||
|
* the number of milliseconds since Jan. 1, 1970 GMT.
|
||||||
|
*/
|
||||||
|
public Date(long milliseconds) {
|
||||||
|
this.milliseconds = milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code Date} initialized to the date and time parsed from the
|
||||||
|
* specified String.
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* the String to parse.
|
||||||
|
*
|
||||||
|
* @deprecated use {@link DateFormat}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public Date(String string) {
|
||||||
|
milliseconds = parse(string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if this {@code Date} is after the specified Date.
|
||||||
|
*
|
||||||
|
* @param date
|
||||||
|
* a Date instance to compare.
|
||||||
|
* @return {@code true} if this {@code Date} is after the specified {@code Date},
|
||||||
|
* {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
public boolean after(Date date) {
|
||||||
|
return milliseconds > date.milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if this {@code Date} is before the specified Date.
|
||||||
|
*
|
||||||
|
* @param date
|
||||||
|
* a {@code Date} instance to compare.
|
||||||
|
* @return {@code true} if this {@code Date} is before the specified {@code Date},
|
||||||
|
* {@code false} otherwise.
|
||||||
|
*/
|
||||||
|
public boolean before(Date date) {
|
||||||
|
return milliseconds < date.milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code Date} with the same millisecond value as this {@code Date}.
|
||||||
|
*
|
||||||
|
* @return a shallow copy of this {@code Date}.
|
||||||
|
*
|
||||||
|
* @see java.lang.Cloneable
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
try {
|
||||||
|
return super.clone();
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the receiver to the specified {@code Date} to determine the relative
|
||||||
|
* ordering.
|
||||||
|
*
|
||||||
|
* @param date
|
||||||
|
* a {@code Date} to compare against.
|
||||||
|
* @return an {@code int < 0} if this {@code Date} is less than the specified {@code Date}, {@code 0} if
|
||||||
|
* they are equal, and an {@code int > 0} if this {@code Date} is greater.
|
||||||
|
*/
|
||||||
|
public int compareTo(Date date) {
|
||||||
|
if (milliseconds < date.milliseconds) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (milliseconds == date.milliseconds) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the specified object to this {@code Date} and returns if they are equal.
|
||||||
|
* To be equal, the object must be an instance of {@code Date} and have the same millisecond
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* the object to compare with this object.
|
||||||
|
* @return {@code true} if the specified object is equal to this {@code Date}, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*
|
||||||
|
* @see #hashCode
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
return (object == this) || (object instanceof Date)
|
||||||
|
&& (milliseconds == ((Date) object).milliseconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar day of the month for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the day of the month.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.DATE)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getDate() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.DATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar day of the week for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the day of the week.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.DAY_OF_WEEK)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getDay() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.DAY_OF_WEEK) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar hour of the day for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the hour of the day.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.HOUR_OF_DAY)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getHours() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.HOUR_OF_DAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar minute of the hour for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the minutes.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.MINUTE)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getMinutes() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.MINUTE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar month for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the month.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.MONTH)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getMonth() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.MONTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar second of the minute for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the seconds.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.SECOND)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getSeconds() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.SECOND);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns this {@code Date} as a millisecond value. The value is the number of
|
||||||
|
* milliseconds since Jan. 1, 1970, midnight GMT.
|
||||||
|
*
|
||||||
|
* @return the number of milliseconds since Jan. 1, 1970, midnight GMT.
|
||||||
|
*/
|
||||||
|
public long getTime() {
|
||||||
|
return milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the timezone offset in minutes of the default {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @return the timezone offset in minutes of the default {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @deprecated use
|
||||||
|
* {@code (Calendar.get(Calendar.ZONE_OFFSET) + Calendar.get(Calendar.DST_OFFSET)) / 60000}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getTimezoneOffset() {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
return -(cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET)) / 60000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the gregorian calendar year since 1900 for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @return the year - 1900.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.get(Calendar.YEAR) - 1900}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public int getYear() {
|
||||||
|
return new GregorianCalendar(milliseconds).get(Calendar.YEAR) - 1900;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an integer hash code for the receiver. Objects which are equal
|
||||||
|
* return the same value for this method.
|
||||||
|
*
|
||||||
|
* @return this {@code Date}'s hash.
|
||||||
|
*
|
||||||
|
* @see #equals
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return (int) (milliseconds >>> 32) ^ (int) milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int parse(String string, String[] array) {
|
||||||
|
for (int i = 0, alength = array.length, slength = string.length(); i < alength; i++) {
|
||||||
|
if (string.regionMatches(true, 0, array[i], 0, slength)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the millisecond value of the date and time parsed from the
|
||||||
|
* specified {@code String}. Many date/time formats are recognized, including IETF
|
||||||
|
* standard syntax, i.e. Tue, 22 Jun 1999 12:16:00 GMT-0500
|
||||||
|
*
|
||||||
|
* @param string
|
||||||
|
* the String to parse.
|
||||||
|
* @return the millisecond value parsed from the String.
|
||||||
|
*
|
||||||
|
* @deprecated use {@link DateFormat}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static long parse(String string) {
|
||||||
|
|
||||||
|
if (string == null) {
|
||||||
|
// luni.06=The string argument is null
|
||||||
|
throw new IllegalArgumentException(Messages.getString("luni.06")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
char sign = 0;
|
||||||
|
int commentLevel = 0;
|
||||||
|
int offset = 0, length = string.length(), state = 0;
|
||||||
|
int year = -1, month = -1, date = -1;
|
||||||
|
int hour = -1, minute = -1, second = -1, zoneOffset = 0, minutesOffset = 0;
|
||||||
|
boolean zone = false;
|
||||||
|
final int PAD = 0, LETTERS = 1, NUMBERS = 2;
|
||||||
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
|
while (offset <= length) {
|
||||||
|
char next = offset < length ? string.charAt(offset) : '\r';
|
||||||
|
offset++;
|
||||||
|
|
||||||
|
if (next == '(') {
|
||||||
|
commentLevel++;
|
||||||
|
}
|
||||||
|
if (commentLevel > 0) {
|
||||||
|
if (next == ')') {
|
||||||
|
commentLevel--;
|
||||||
|
}
|
||||||
|
if (commentLevel == 0) {
|
||||||
|
next = ' ';
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int nextState = PAD;
|
||||||
|
if ('a' <= next && next <= 'z' || 'A' <= next && next <= 'Z') {
|
||||||
|
nextState = LETTERS;
|
||||||
|
} else if ('0' <= next && next <= '9') {
|
||||||
|
nextState = NUMBERS;
|
||||||
|
} else if (!Character.isSpace(next) && ",+-:/".indexOf(next) == -1) { //$NON-NLS-1$
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == NUMBERS && nextState != NUMBERS) {
|
||||||
|
int digit = Integer.parseInt(buffer.toString());
|
||||||
|
buffer.setLength(0);
|
||||||
|
if (sign == '+' || sign == '-') {
|
||||||
|
if (zoneOffset == 0) {
|
||||||
|
zone = true;
|
||||||
|
if (next == ':') {
|
||||||
|
minutesOffset = sign == '-' ? -Integer
|
||||||
|
.parseInt(string.substring(offset,
|
||||||
|
offset + 2)) : Integer
|
||||||
|
.parseInt(string.substring(offset,
|
||||||
|
offset + 2));
|
||||||
|
offset += 2;
|
||||||
|
}
|
||||||
|
zoneOffset = sign == '-' ? -digit : digit;
|
||||||
|
sign = 0;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (digit >= 70) {
|
||||||
|
if (year == -1
|
||||||
|
&& (Character.isSpace(next) || next == ','
|
||||||
|
|| next == '/' || next == '\r')) {
|
||||||
|
year = digit;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (next == ':') {
|
||||||
|
if (hour == -1) {
|
||||||
|
hour = digit;
|
||||||
|
} else if (minute == -1) {
|
||||||
|
minute = digit;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (next == '/') {
|
||||||
|
if (month == -1) {
|
||||||
|
month = digit - 1;
|
||||||
|
} else if (date == -1) {
|
||||||
|
date = digit;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (Character.isSpace(next) || next == ','
|
||||||
|
|| next == '-' || next == '\r') {
|
||||||
|
if (hour != -1 && minute == -1) {
|
||||||
|
minute = digit;
|
||||||
|
} else if (minute != -1 && second == -1) {
|
||||||
|
second = digit;
|
||||||
|
} else if (date == -1) {
|
||||||
|
date = digit;
|
||||||
|
} else if (year == -1) {
|
||||||
|
year = digit;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (year == -1 && month != -1 && date != -1) {
|
||||||
|
year = digit;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (state == LETTERS && nextState != LETTERS) {
|
||||||
|
String text = buffer.toString().toUpperCase();
|
||||||
|
buffer.setLength(0);
|
||||||
|
if (text.length() == 1) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
if (text.equals("AM")) { //$NON-NLS-1$
|
||||||
|
if (hour == 12) {
|
||||||
|
hour = 0;
|
||||||
|
} else if (hour < 1 || hour > 12) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
} else if (text.equals("PM")) { //$NON-NLS-1$
|
||||||
|
if (hour == 12) {
|
||||||
|
hour = 0;
|
||||||
|
} else if (hour < 1 || hour > 12) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
hour += 12;
|
||||||
|
} else {
|
||||||
|
DateFormatSymbols symbols = new DateFormatSymbols(Locale.US);
|
||||||
|
String[] weekdays = symbols.getWeekdays(), months = symbols
|
||||||
|
.getMonths();
|
||||||
|
int value;
|
||||||
|
if (parse(text, weekdays) != -1) {/* empty */
|
||||||
|
} else if (month == -1
|
||||||
|
&& (month = parse(text, months)) != -1) {/* empty */
|
||||||
|
} else if (text.equals("GMT") || text.equals("UT") //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|| text.equals("UTC")) { //$NON-NLS-1$
|
||||||
|
zone = true;
|
||||||
|
zoneOffset = 0;
|
||||||
|
} else if ((value = zone(text)) != 0) {
|
||||||
|
zone = true;
|
||||||
|
zoneOffset = value;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (next == '+' || (year != -1 && next == '-')) {
|
||||||
|
sign = next;
|
||||||
|
} else if (!Character.isSpace(next) && next != ','
|
||||||
|
&& nextState != NUMBERS) {
|
||||||
|
sign = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nextState == LETTERS || nextState == NUMBERS) {
|
||||||
|
buffer.append(next);
|
||||||
|
}
|
||||||
|
state = nextState;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (year != -1 && month != -1 && date != -1) {
|
||||||
|
if (hour == -1) {
|
||||||
|
hour = 0;
|
||||||
|
}
|
||||||
|
if (minute == -1) {
|
||||||
|
minute = 0;
|
||||||
|
}
|
||||||
|
if (second == -1) {
|
||||||
|
second = 0;
|
||||||
|
}
|
||||||
|
if (year < (creationYear - 80)) {
|
||||||
|
year += 2000;
|
||||||
|
} else if (year < 100) {
|
||||||
|
year += 1900;
|
||||||
|
}
|
||||||
|
minute -= minutesOffset;
|
||||||
|
if (zone) {
|
||||||
|
if (zoneOffset >= 24 || zoneOffset <= -24) {
|
||||||
|
hour -= zoneOffset / 100;
|
||||||
|
minute -= zoneOffset % 100;
|
||||||
|
} else {
|
||||||
|
hour -= zoneOffset;
|
||||||
|
}
|
||||||
|
return UTC(year - 1900, month, date, hour, minute, second);
|
||||||
|
}
|
||||||
|
return new Date(year - 1900, month, date, hour, minute, second)
|
||||||
|
.getTime();
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gregorian calendar day of the month for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @param day
|
||||||
|
* the day of the month.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.set(Calendar.DATE, day)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setDate(int day) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
cal.set(Calendar.DATE, day);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gregorian calendar hour of the day for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @param hour
|
||||||
|
* the hour of the day.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.set(Calendar.HOUR_OF_DAY, hour)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setHours(int hour) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, hour);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gregorian calendar minute of the hour for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @param minute
|
||||||
|
* the minutes.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.set(Calendar.MINUTE, minute)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setMinutes(int minute) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
cal.set(Calendar.MINUTE, minute);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gregorian calendar month for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the month.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.set(Calendar.MONTH, month)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setMonth(int month) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
cal.set(Calendar.MONTH, month);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gregorian calendar second of the minute for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @param second
|
||||||
|
* the seconds.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.set(Calendar.SECOND, second)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setSeconds(int second) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
cal.set(Calendar.SECOND, second);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets this {@code Date} to the specified millisecond value. The value is the
|
||||||
|
* number of milliseconds since Jan. 1, 1970 GMT.
|
||||||
|
*
|
||||||
|
* @param milliseconds
|
||||||
|
* the number of milliseconds since Jan. 1, 1970 GMT.
|
||||||
|
*/
|
||||||
|
public void setTime(long milliseconds) {
|
||||||
|
this.milliseconds = milliseconds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gregorian calendar year since 1900 for this {@code Date} object.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* the year since 1900.
|
||||||
|
*
|
||||||
|
* @deprecated use {@code Calendar.set(Calendar.YEAR, year + 1900)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public void setYear(int year) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
cal.set(Calendar.YEAR, year + 1900);
|
||||||
|
milliseconds = cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the string representation of this {@code Date} in GMT in the format: 22
|
||||||
|
* Jun 1999 13:02:00 GMT
|
||||||
|
*
|
||||||
|
* @return the string representation of this {@code Date} in GMT.
|
||||||
|
*
|
||||||
|
* @deprecated use {@link DateFormat}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public String toGMTString() {
|
||||||
|
SimpleDateFormat format1 = new SimpleDateFormat("d MMM ", Locale.US); //$NON-NLS-1$
|
||||||
|
SimpleDateFormat format2 = new SimpleDateFormat(
|
||||||
|
" HH:mm:ss 'GMT'", Locale.US); //$NON-NLS-1$
|
||||||
|
TimeZone gmtZone = TimeZone.getTimeZone("GMT"); //$NON-NLS-1$
|
||||||
|
format1.setTimeZone(gmtZone);
|
||||||
|
format2.setTimeZone(gmtZone);
|
||||||
|
GregorianCalendar gc = new GregorianCalendar(gmtZone);
|
||||||
|
gc.setTimeInMillis(milliseconds);
|
||||||
|
return format1.format(this) + gc.get(Calendar.YEAR)
|
||||||
|
+ format2.format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the string representation of this {@code Date} for the default {@code Locale}.
|
||||||
|
*
|
||||||
|
* @return the string representation of this {@code Date} for the default {@code Locale}.
|
||||||
|
*
|
||||||
|
* @deprecated use {@link DateFormat}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public String toLocaleString() {
|
||||||
|
return DateFormat.getDateTimeInstance().format(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the string representation of this {@code Date} in the format: Tue Jun 22
|
||||||
|
* 13:07:00 GMT 1999
|
||||||
|
*
|
||||||
|
* @return the string representation of this {@code Date}.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
Calendar cal = new GregorianCalendar(milliseconds);
|
||||||
|
TimeZone zone = cal.getTimeZone();
|
||||||
|
String zoneName = zone.getDisplayName(zone.inDaylightTime(this),
|
||||||
|
TimeZone.SHORT, Locale.getDefault());
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(34);
|
||||||
|
sb.append(dayOfWeekNames[cal.get(Calendar.DAY_OF_WEEK) - 1]);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(monthNames[cal.get(Calendar.MONTH)]);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(toTwoDigits(cal.get(Calendar.DAY_OF_MONTH)));
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(toTwoDigits(cal.get(Calendar.HOUR_OF_DAY)));
|
||||||
|
sb.append(':');
|
||||||
|
sb.append(toTwoDigits(cal.get(Calendar.MINUTE)));
|
||||||
|
sb.append(':');
|
||||||
|
sb.append(toTwoDigits(cal.get(Calendar.SECOND)));
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(zoneName);
|
||||||
|
sb.append(' ');
|
||||||
|
sb.append(cal.get(Calendar.YEAR));
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String toTwoDigits(int digit) {
|
||||||
|
if(digit >= 10) {
|
||||||
|
return "" + digit;//$NON-NLS-1$
|
||||||
|
} else {
|
||||||
|
return "0" + digit;//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the millisecond value of the specified date and time in GMT.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* the year, 0 is 1900.
|
||||||
|
* @param month
|
||||||
|
* the month, 0 - 11.
|
||||||
|
* @param day
|
||||||
|
* the day of the month, 1 - 31.
|
||||||
|
* @param hour
|
||||||
|
* the hour of day, 0 - 23.
|
||||||
|
* @param minute
|
||||||
|
* the minute of the hour, 0 - 59.
|
||||||
|
* @param second
|
||||||
|
* the second of the minute, 0 - 59.
|
||||||
|
* @return the date and time in GMT in milliseconds.
|
||||||
|
*
|
||||||
|
* @deprecated use: <code>
|
||||||
|
* Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||||
|
* cal.set(year + 1900, month, day, hour, minute, second);
|
||||||
|
* cal.getTime().getTime();</code>
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static long UTC(int year, int month, int day, int hour, int minute,
|
||||||
|
int second) {
|
||||||
|
GregorianCalendar cal = new GregorianCalendar(false);
|
||||||
|
cal.setTimeZone(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$
|
||||||
|
cal.set(1900 + year, month, day, hour, minute, second);
|
||||||
|
return cal.getTimeInMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int zone(String text) {
|
||||||
|
if (text.equals("EST")) { //$NON-NLS-1$
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
|
if (text.equals("EDT")) { //$NON-NLS-1$
|
||||||
|
return -4;
|
||||||
|
}
|
||||||
|
if (text.equals("CST")) { //$NON-NLS-1$
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if (text.equals("CDT")) { //$NON-NLS-1$
|
||||||
|
return -5;
|
||||||
|
}
|
||||||
|
if (text.equals("MST")) { //$NON-NLS-1$
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
if (text.equals("MDT")) { //$NON-NLS-1$
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if (text.equals("PST")) { //$NON-NLS-1$
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
if (text.equals("PDT")) { //$NON-NLS-1$
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeObject(ObjectOutputStream stream) throws IOException {
|
||||||
|
stream.defaultWriteObject();
|
||||||
|
stream.writeLong(getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(ObjectInputStream stream) throws IOException,
|
||||||
|
ClassNotFoundException {
|
||||||
|
stream.defaultReadObject();
|
||||||
|
setTime(stream.readLong());
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,873 @@
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.teavm.classlib.java.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectInputStream;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
|
import java.io.ObjectStreamField;
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
|
|
||||||
|
import org.apache.harmony.luni.internal.nls.Messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code SimpleTimeZone} is a concrete subclass of {@code TimeZone}
|
||||||
|
* that represents a time zone for use with a Gregorian calendar. This class
|
||||||
|
* does not handle historical changes.
|
||||||
|
* <p>
|
||||||
|
* Use a negative value for {@code dayOfWeekInMonth} to indicate that
|
||||||
|
* {@code SimpleTimeZone} should count from the end of the month
|
||||||
|
* backwards. For example, Daylight Savings Time ends at the last
|
||||||
|
* (dayOfWeekInMonth = -1) Sunday in October, at 2 AM in standard time.
|
||||||
|
*
|
||||||
|
* @see Calendar
|
||||||
|
* @see GregorianCalendar
|
||||||
|
* @see TimeZone
|
||||||
|
*/
|
||||||
|
public class SimpleTimeZone extends TimeZone {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -403250971215465050L;
|
||||||
|
|
||||||
|
private int rawOffset;
|
||||||
|
|
||||||
|
private int startYear, startMonth, startDay, startDayOfWeek, startTime;
|
||||||
|
|
||||||
|
private int endMonth, endDay, endDayOfWeek, endTime;
|
||||||
|
|
||||||
|
private int startMode, endMode;
|
||||||
|
|
||||||
|
private static final int DOM_MODE = 1, DOW_IN_MONTH_MODE = 2,
|
||||||
|
DOW_GE_DOM_MODE = 3, DOW_LE_DOM_MODE = 4;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constant for representing a start or end time in GMT time mode.
|
||||||
|
*/
|
||||||
|
public static final int UTC_TIME = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constant for representing a start or end time in standard local time mode,
|
||||||
|
* based on timezone's raw offset from GMT; does not include Daylight
|
||||||
|
* savings.
|
||||||
|
*/
|
||||||
|
public static final int STANDARD_TIME = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constant for representing a start or end time in local wall clock time
|
||||||
|
* mode, based on timezone's adjusted offset from GMT; includes
|
||||||
|
* Daylight savings.
|
||||||
|
*/
|
||||||
|
public static final int WALL_TIME = 0;
|
||||||
|
|
||||||
|
private boolean useDaylight;
|
||||||
|
|
||||||
|
private GregorianCalendar daylightSavings;
|
||||||
|
|
||||||
|
private int dstSavings = 3600000;
|
||||||
|
|
||||||
|
private final transient com.ibm.icu.util.TimeZone icuTZ;
|
||||||
|
|
||||||
|
private final transient boolean isSimple;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a {@code SimpleTimeZone} with the given base time zone offset from GMT
|
||||||
|
* and time zone ID. Timezone IDs can be obtained from
|
||||||
|
* {@code TimeZone.getAvailableIDs}. Normally you should use {@code TimeZone.getDefault} to
|
||||||
|
* construct a {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param offset
|
||||||
|
* the given base time zone offset to GMT.
|
||||||
|
* @param name
|
||||||
|
* the time zone ID which is obtained from
|
||||||
|
* {@code TimeZone.getAvailableIDs}.
|
||||||
|
*/
|
||||||
|
public SimpleTimeZone(int offset, final String name) {
|
||||||
|
setID(name);
|
||||||
|
rawOffset = offset;
|
||||||
|
icuTZ = getICUTimeZone(name);
|
||||||
|
if (icuTZ instanceof com.ibm.icu.util.SimpleTimeZone) {
|
||||||
|
isSimple = true;
|
||||||
|
icuTZ.setRawOffset(offset);
|
||||||
|
} else {
|
||||||
|
isSimple = false;
|
||||||
|
}
|
||||||
|
useDaylight = icuTZ.useDaylightTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a {@code SimpleTimeZone} with the given base time zone offset from GMT,
|
||||||
|
* time zone ID, and times to start and end the daylight savings time. Timezone IDs can
|
||||||
|
* be obtained from {@code TimeZone.getAvailableIDs}. Normally you should use
|
||||||
|
* {@code TimeZone.getDefault} to create a {@code TimeZone}. For a time zone that does not
|
||||||
|
* use daylight saving time, do not use this constructor; instead you should
|
||||||
|
* use {@code SimpleTimeZone(rawOffset, ID)}.
|
||||||
|
* <p>
|
||||||
|
* By default, this constructor specifies day-of-week-in-month rules. That
|
||||||
|
* is, if the {@code startDay} is 1, and the {@code startDayOfWeek} is {@code SUNDAY}, then this
|
||||||
|
* indicates the first Sunday in the {@code startMonth}. A {@code startDay} of -1 likewise
|
||||||
|
* indicates the last Sunday. However, by using negative or zero values for
|
||||||
|
* certain parameters, other types of rules can be specified.
|
||||||
|
* <p>
|
||||||
|
* Day of month: To specify an exact day of the month, such as March 1, set
|
||||||
|
* {@code startDayOfWeek} to zero.
|
||||||
|
* <p>
|
||||||
|
* Day of week after day of month: To specify the first day of the week
|
||||||
|
* occurring on or after an exact day of the month, make the day of the week
|
||||||
|
* negative. For example, if {@code startDay} is 5 and {@code startDayOfWeek} is {@code -MONDAY},
|
||||||
|
* this indicates the first Monday on or after the 5th day of the
|
||||||
|
* {@code startMonth}.
|
||||||
|
* <p>
|
||||||
|
* Day of week before day of month: To specify the last day of the week
|
||||||
|
* occurring on or before an exact day of the month, make the day of the
|
||||||
|
* week and the day of the month negative. For example, if {@code startDay} is {@code -21}
|
||||||
|
* and {@code startDayOfWeek} is {@code -WEDNESDAY}, this indicates the last Wednesday on or
|
||||||
|
* before the 21st of the {@code startMonth}.
|
||||||
|
* <p>
|
||||||
|
* The above examples refer to the {@code startMonth}, {@code startDay}, and {@code startDayOfWeek};
|
||||||
|
* the same applies for the {@code endMonth}, {@code endDay}, and {@code endDayOfWeek}.
|
||||||
|
* <p>
|
||||||
|
* The daylight savings time difference is set to the default value: one hour.
|
||||||
|
*
|
||||||
|
* @param offset
|
||||||
|
* the given base time zone offset to GMT.
|
||||||
|
* @param name
|
||||||
|
* the time zone ID which is obtained from
|
||||||
|
* {@code TimeZone.getAvailableIDs}.
|
||||||
|
* @param startMonth
|
||||||
|
* the daylight savings starting month. The month indexing is 0-based. eg, 0
|
||||||
|
* for January.
|
||||||
|
* @param startDay
|
||||||
|
* the daylight savings starting day-of-week-in-month. Please see
|
||||||
|
* the member description for an example.
|
||||||
|
* @param startDayOfWeek
|
||||||
|
* the daylight savings starting day-of-week. Please see the
|
||||||
|
* member description for an example.
|
||||||
|
* @param startTime
|
||||||
|
* the daylight savings starting time in local wall time, which
|
||||||
|
* is standard time in this case. Please see the member
|
||||||
|
* description for an example.
|
||||||
|
* @param endMonth
|
||||||
|
* the daylight savings ending month. The month indexing is 0-based. eg, 0 for
|
||||||
|
* January.
|
||||||
|
* @param endDay
|
||||||
|
* the daylight savings ending day-of-week-in-month. Please see
|
||||||
|
* the member description for an example.
|
||||||
|
* @param endDayOfWeek
|
||||||
|
* the daylight savings ending day-of-week. Please see the member
|
||||||
|
* description for an example.
|
||||||
|
* @param endTime
|
||||||
|
* the daylight savings ending time in local wall time, which is
|
||||||
|
* daylight time in this case. Please see the member description
|
||||||
|
* for an example.
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
* if the month, day, dayOfWeek, or time parameters are out of
|
||||||
|
* range for the start or end rule.
|
||||||
|
*/
|
||||||
|
public SimpleTimeZone(int offset, String name, int startMonth,
|
||||||
|
int startDay, int startDayOfWeek, int startTime, int endMonth,
|
||||||
|
int endDay, int endDayOfWeek, int endTime) {
|
||||||
|
this(offset, name, startMonth, startDay, startDayOfWeek, startTime,
|
||||||
|
endMonth, endDay, endDayOfWeek, endTime, 3600000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a {@code SimpleTimeZone} with the given base time zone offset from GMT,
|
||||||
|
* time zone ID, times to start and end the daylight savings time, and
|
||||||
|
* the daylight savings time difference in milliseconds.
|
||||||
|
*
|
||||||
|
* @param offset
|
||||||
|
* the given base time zone offset to GMT.
|
||||||
|
* @param name
|
||||||
|
* the time zone ID which is obtained from
|
||||||
|
* {@code TimeZone.getAvailableIDs}.
|
||||||
|
* @param startMonth
|
||||||
|
* the daylight savings starting month. Month is 0-based. eg, 0
|
||||||
|
* for January.
|
||||||
|
* @param startDay
|
||||||
|
* the daylight savings starting day-of-week-in-month. Please see
|
||||||
|
* the description of {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param startDayOfWeek
|
||||||
|
* the daylight savings starting day-of-week. Please see the
|
||||||
|
* description of {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param startTime
|
||||||
|
* The daylight savings starting time in local wall time, which
|
||||||
|
* is standard time in this case. Please see the description of
|
||||||
|
* {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param endMonth
|
||||||
|
* the daylight savings ending month. Month is 0-based. eg, 0 for
|
||||||
|
* January.
|
||||||
|
* @param endDay
|
||||||
|
* the daylight savings ending day-of-week-in-month. Please see
|
||||||
|
* the description of {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param endDayOfWeek
|
||||||
|
* the daylight savings ending day-of-week. Please see the description of
|
||||||
|
* {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param endTime
|
||||||
|
* the daylight savings ending time in local wall time, which is
|
||||||
|
* daylight time in this case. Please see the description of {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)}
|
||||||
|
* for an example.
|
||||||
|
* @param daylightSavings
|
||||||
|
* the daylight savings time difference in milliseconds.
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
* if the month, day, dayOfWeek, or time parameters are out of
|
||||||
|
* range for the start or end rule.
|
||||||
|
*/
|
||||||
|
public SimpleTimeZone(int offset, String name, int startMonth,
|
||||||
|
int startDay, int startDayOfWeek, int startTime, int endMonth,
|
||||||
|
int endDay, int endDayOfWeek, int endTime, int daylightSavings) {
|
||||||
|
icuTZ = getICUTimeZone(name);
|
||||||
|
if (icuTZ instanceof com.ibm.icu.util.SimpleTimeZone) {
|
||||||
|
isSimple = true;
|
||||||
|
com.ibm.icu.util.SimpleTimeZone tz = (com.ibm.icu.util.SimpleTimeZone)icuTZ;
|
||||||
|
tz.setRawOffset(offset);
|
||||||
|
tz.setStartRule(startMonth, startDay, startDayOfWeek, startTime);
|
||||||
|
tz.setEndRule(endMonth, endDay, endDayOfWeek, endTime);
|
||||||
|
tz.setDSTSavings(daylightSavings);
|
||||||
|
} else {
|
||||||
|
isSimple = false;
|
||||||
|
}
|
||||||
|
setID(name);
|
||||||
|
rawOffset = offset;
|
||||||
|
if (daylightSavings <= 0) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString(
|
||||||
|
"luni.3B", daylightSavings)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
dstSavings = daylightSavings;
|
||||||
|
|
||||||
|
setStartRule(startMonth, startDay, startDayOfWeek, startTime);
|
||||||
|
setEndRule(endMonth, endDay, endDayOfWeek, endTime);
|
||||||
|
|
||||||
|
useDaylight = daylightSavings > 0 || icuTZ.useDaylightTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a {@code SimpleTimeZone} with the given base time zone offset from GMT,
|
||||||
|
* time zone ID, times to start and end the daylight savings time including a
|
||||||
|
* mode specifier, the daylight savings time difference in milliseconds.
|
||||||
|
* The mode specifies either {@link #WALL_TIME}, {@link #STANDARD_TIME}, or
|
||||||
|
* {@link #UTC_TIME}.
|
||||||
|
*
|
||||||
|
* @param offset
|
||||||
|
* the given base time zone offset to GMT.
|
||||||
|
* @param name
|
||||||
|
* the time zone ID which is obtained from
|
||||||
|
* {@code TimeZone.getAvailableIDs}.
|
||||||
|
* @param startMonth
|
||||||
|
* the daylight savings starting month. The month indexing is 0-based. eg, 0
|
||||||
|
* for January.
|
||||||
|
* @param startDay
|
||||||
|
* the daylight savings starting day-of-week-in-month. Please see
|
||||||
|
* the description of {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param startDayOfWeek
|
||||||
|
* the daylight savings starting day-of-week. Please see the
|
||||||
|
* description of {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param startTime
|
||||||
|
* the time of day in milliseconds on which daylight savings
|
||||||
|
* time starts, based on the {@code startTimeMode}.
|
||||||
|
* @param startTimeMode
|
||||||
|
* the mode (UTC, standard, or wall time) of the start time
|
||||||
|
* value.
|
||||||
|
* @param endDay
|
||||||
|
* the day of the week on which daylight savings time ends.
|
||||||
|
* @param endMonth
|
||||||
|
* the daylight savings ending month. The month indexing is 0-based. eg, 0 for
|
||||||
|
* January.
|
||||||
|
* @param endDayOfWeek
|
||||||
|
* the daylight savings ending day-of-week. Please see the description of
|
||||||
|
* {@link #SimpleTimeZone(int, String, int, int, int, int, int, int, int, int)} for an example.
|
||||||
|
* @param endTime
|
||||||
|
* the time of day in milliseconds on which daylight savings
|
||||||
|
* time ends, based on the {@code endTimeMode}.
|
||||||
|
* @param endTimeMode
|
||||||
|
* the mode (UTC, standard, or wall time) of the end time value.
|
||||||
|
* @param daylightSavings
|
||||||
|
* the daylight savings time difference in milliseconds.
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
* if the month, day, dayOfWeek, or time parameters are out of
|
||||||
|
* range for the start or end rule.
|
||||||
|
*/
|
||||||
|
public SimpleTimeZone(int offset, String name, int startMonth,
|
||||||
|
int startDay, int startDayOfWeek, int startTime, int startTimeMode,
|
||||||
|
int endMonth, int endDay, int endDayOfWeek, int endTime,
|
||||||
|
int endTimeMode, int daylightSavings) {
|
||||||
|
|
||||||
|
this(offset, name, startMonth, startDay, startDayOfWeek, startTime,
|
||||||
|
endMonth, endDay, endDayOfWeek, endTime, daylightSavings);
|
||||||
|
startMode = startTimeMode;
|
||||||
|
endMode = endTimeMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new {@code SimpleTimeZone} with the same ID, {@code rawOffset} and daylight
|
||||||
|
* savings time rules as this SimpleTimeZone.
|
||||||
|
*
|
||||||
|
* @return a shallow copy of this {@code SimpleTimeZone}.
|
||||||
|
* @see java.lang.Cloneable
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
SimpleTimeZone zone = (SimpleTimeZone) super.clone();
|
||||||
|
if (daylightSavings != null) {
|
||||||
|
zone.daylightSavings = (GregorianCalendar) daylightSavings.clone();
|
||||||
|
}
|
||||||
|
return zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the specified object to this {@code SimpleTimeZone} and returns whether they
|
||||||
|
* are equal. The object must be an instance of {@code SimpleTimeZone} and have the
|
||||||
|
* same internal data.
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* the object to compare with this object.
|
||||||
|
* @return {@code true} if the specified object is equal to this
|
||||||
|
* {@code SimpleTimeZone}, {@code false} otherwise.
|
||||||
|
* @see #hashCode
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object object) {
|
||||||
|
if (!(object instanceof SimpleTimeZone)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SimpleTimeZone tz = (SimpleTimeZone) object;
|
||||||
|
return getID().equals(tz.getID())
|
||||||
|
&& rawOffset == tz.rawOffset
|
||||||
|
&& useDaylight == tz.useDaylight
|
||||||
|
&& (!useDaylight || (startYear == tz.startYear
|
||||||
|
&& startMonth == tz.startMonth
|
||||||
|
&& startDay == tz.startDay && startMode == tz.startMode
|
||||||
|
&& startDayOfWeek == tz.startDayOfWeek
|
||||||
|
&& startTime == tz.startTime && endMonth == tz.endMonth
|
||||||
|
&& endDay == tz.endDay
|
||||||
|
&& endDayOfWeek == tz.endDayOfWeek
|
||||||
|
&& endTime == tz.endTime && endMode == tz.endMode && dstSavings == tz.dstSavings));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getDSTSavings() {
|
||||||
|
if (!useDaylight) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return dstSavings;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOffset(int era, int year, int month, int day, int dayOfWeek,
|
||||||
|
int time) {
|
||||||
|
if (era != GregorianCalendar.BC && era != GregorianCalendar.AD) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString("luni.3C", era)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
checkRange(month, dayOfWeek, time);
|
||||||
|
if (month != Calendar.FEBRUARY || day != 29 || !isLeapYear(year)) {
|
||||||
|
checkDay(month, day);
|
||||||
|
}
|
||||||
|
return icuTZ.getOffset(era, year, month, day, dayOfWeek, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getOffset(long time) {
|
||||||
|
return icuTZ.getOffset(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRawOffset() {
|
||||||
|
return rawOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an integer hash code for the receiver. Objects which are equal
|
||||||
|
* return the same value for this method.
|
||||||
|
*
|
||||||
|
* @return the receiver's hash.
|
||||||
|
* @see #equals
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public synchronized int hashCode() {
|
||||||
|
int hashCode = getID().hashCode() + rawOffset;
|
||||||
|
if (useDaylight) {
|
||||||
|
hashCode += startYear + startMonth + startDay + startDayOfWeek
|
||||||
|
+ startTime + startMode + endMonth + endDay + endDayOfWeek
|
||||||
|
+ endTime + endMode + dstSavings;
|
||||||
|
}
|
||||||
|
return hashCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasSameRules(TimeZone zone) {
|
||||||
|
if (!(zone instanceof SimpleTimeZone)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SimpleTimeZone tz = (SimpleTimeZone) zone;
|
||||||
|
if (useDaylight != tz.useDaylight) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!useDaylight) {
|
||||||
|
return rawOffset == tz.rawOffset;
|
||||||
|
}
|
||||||
|
return rawOffset == tz.rawOffset && dstSavings == tz.dstSavings
|
||||||
|
&& startYear == tz.startYear && startMonth == tz.startMonth
|
||||||
|
&& startDay == tz.startDay && startMode == tz.startMode
|
||||||
|
&& startDayOfWeek == tz.startDayOfWeek
|
||||||
|
&& startTime == tz.startTime && endMonth == tz.endMonth
|
||||||
|
&& endDay == tz.endDay && endDayOfWeek == tz.endDayOfWeek
|
||||||
|
&& endTime == tz.endTime && endMode == tz.endMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean inDaylightTime(Date time) {
|
||||||
|
return icuTZ.inDaylightTime(time);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isLeapYear(int year) {
|
||||||
|
if (year > 1582) {
|
||||||
|
return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
|
||||||
|
}
|
||||||
|
return year % 4 == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the daylight savings offset in milliseconds for this {@code SimpleTimeZone}.
|
||||||
|
*
|
||||||
|
* @param milliseconds
|
||||||
|
* the daylight savings offset in milliseconds.
|
||||||
|
*/
|
||||||
|
public void setDSTSavings(int milliseconds) {
|
||||||
|
if (milliseconds > 0) {
|
||||||
|
dstSavings = milliseconds;
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkRange(int month, int dayOfWeek, int time) {
|
||||||
|
if (month < Calendar.JANUARY || month > Calendar.DECEMBER) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString("luni.3D", month)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (dayOfWeek < Calendar.SUNDAY || dayOfWeek > Calendar.SATURDAY) {
|
||||||
|
throw new IllegalArgumentException(Messages
|
||||||
|
.getString("luni.48", dayOfWeek)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (time < 0 || time >= 24 * 3600000) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString("luni.3E", time)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkDay(int month, int day) {
|
||||||
|
if (day <= 0 || day > GregorianCalendar.DaysInMonth[month]) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString("luni.3F", day)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setEndMode() {
|
||||||
|
if (endDayOfWeek == 0) {
|
||||||
|
endMode = DOM_MODE;
|
||||||
|
} else if (endDayOfWeek < 0) {
|
||||||
|
endDayOfWeek = -endDayOfWeek;
|
||||||
|
if (endDay < 0) {
|
||||||
|
endDay = -endDay;
|
||||||
|
endMode = DOW_LE_DOM_MODE;
|
||||||
|
} else {
|
||||||
|
endMode = DOW_GE_DOM_MODE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
endMode = DOW_IN_MONTH_MODE;
|
||||||
|
}
|
||||||
|
useDaylight = startDay != 0 && endDay != 0;
|
||||||
|
if (endDay != 0) {
|
||||||
|
checkRange(endMonth, endMode == DOM_MODE ? 1 : endDayOfWeek,
|
||||||
|
endTime);
|
||||||
|
if (endMode != DOW_IN_MONTH_MODE) {
|
||||||
|
checkDay(endMonth, endDay);
|
||||||
|
} else {
|
||||||
|
if (endDay < -5 || endDay > 5) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString(
|
||||||
|
"luni.40", endDay)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (endMode != DOM_MODE) {
|
||||||
|
endDayOfWeek--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rule which specifies the end of daylight savings time.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month in which daylight savings time ends.
|
||||||
|
* @param dayOfMonth
|
||||||
|
* the {@code Calendar} day of the month on which daylight savings time
|
||||||
|
* ends.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds standard time on which
|
||||||
|
* daylight savings time ends.
|
||||||
|
*/
|
||||||
|
public void setEndRule(int month, int dayOfMonth, int time) {
|
||||||
|
endMonth = month;
|
||||||
|
endDay = dayOfMonth;
|
||||||
|
endDayOfWeek = 0; // Initialize this value for hasSameRules()
|
||||||
|
endTime = time;
|
||||||
|
setEndMode();
|
||||||
|
if (isSimple) {
|
||||||
|
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month,
|
||||||
|
dayOfMonth, time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rule which specifies the end of daylight savings time.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month in which daylight savings time ends.
|
||||||
|
* @param day
|
||||||
|
* the occurrence of the day of the week on which daylight
|
||||||
|
* savings time ends.
|
||||||
|
* @param dayOfWeek
|
||||||
|
* the {@code Calendar} day of the week on which daylight savings time
|
||||||
|
* ends.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds standard time on which
|
||||||
|
* daylight savings time ends.
|
||||||
|
*/
|
||||||
|
public void setEndRule(int month, int day, int dayOfWeek, int time) {
|
||||||
|
endMonth = month;
|
||||||
|
endDay = day;
|
||||||
|
endDayOfWeek = dayOfWeek;
|
||||||
|
endTime = time;
|
||||||
|
setEndMode();
|
||||||
|
if (isSimple) {
|
||||||
|
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, day,
|
||||||
|
dayOfWeek, time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rule which specifies the end of daylight savings time.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month in which daylight savings time ends.
|
||||||
|
* @param day
|
||||||
|
* the {@code Calendar} day of the month.
|
||||||
|
* @param dayOfWeek
|
||||||
|
* the {@code Calendar} day of the week on which daylight savings time
|
||||||
|
* ends.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds on which daylight savings time
|
||||||
|
* ends.
|
||||||
|
* @param after
|
||||||
|
* selects the day after or before the day of month.
|
||||||
|
*/
|
||||||
|
public void setEndRule(int month, int day, int dayOfWeek, int time,
|
||||||
|
boolean after) {
|
||||||
|
endMonth = month;
|
||||||
|
endDay = after ? day : -day;
|
||||||
|
endDayOfWeek = -dayOfWeek;
|
||||||
|
endTime = time;
|
||||||
|
setEndMode();
|
||||||
|
if (isSimple) {
|
||||||
|
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setEndRule(month, day,
|
||||||
|
dayOfWeek, time, after);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the offset for standard time from GMT for this {@code SimpleTimeZone}.
|
||||||
|
*
|
||||||
|
* @param offset
|
||||||
|
* the offset from GMT of standard time in milliseconds.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setRawOffset(int offset) {
|
||||||
|
rawOffset = offset;
|
||||||
|
icuTZ.setRawOffset(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setStartMode() {
|
||||||
|
if (startDayOfWeek == 0) {
|
||||||
|
startMode = DOM_MODE;
|
||||||
|
} else if (startDayOfWeek < 0) {
|
||||||
|
startDayOfWeek = -startDayOfWeek;
|
||||||
|
if (startDay < 0) {
|
||||||
|
startDay = -startDay;
|
||||||
|
startMode = DOW_LE_DOM_MODE;
|
||||||
|
} else {
|
||||||
|
startMode = DOW_GE_DOM_MODE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
startMode = DOW_IN_MONTH_MODE;
|
||||||
|
}
|
||||||
|
useDaylight = startDay != 0 && endDay != 0;
|
||||||
|
if (startDay != 0) {
|
||||||
|
checkRange(startMonth, startMode == DOM_MODE ? 1 : startDayOfWeek,
|
||||||
|
startTime);
|
||||||
|
if (startMode != DOW_IN_MONTH_MODE) {
|
||||||
|
checkDay(startMonth, startDay);
|
||||||
|
} else {
|
||||||
|
if (startDay < -5 || startDay > 5) {
|
||||||
|
throw new IllegalArgumentException(Messages.getString(
|
||||||
|
"luni.40", startDay)); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (startMode != DOM_MODE) {
|
||||||
|
startDayOfWeek--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rule which specifies the start of daylight savings time.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month in which daylight savings time starts.
|
||||||
|
* @param dayOfMonth
|
||||||
|
* the {@code Calendar} day of the month on which daylight savings time
|
||||||
|
* starts.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds on which daylight savings time
|
||||||
|
* starts.
|
||||||
|
*/
|
||||||
|
public void setStartRule(int month, int dayOfMonth, int time) {
|
||||||
|
startMonth = month;
|
||||||
|
startDay = dayOfMonth;
|
||||||
|
startDayOfWeek = 0; // Initialize this value for hasSameRules()
|
||||||
|
startTime = time;
|
||||||
|
setStartMode();
|
||||||
|
if (isSimple) {
|
||||||
|
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month,
|
||||||
|
dayOfMonth, time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rule which specifies the start of daylight savings time.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month in which daylight savings time starts.
|
||||||
|
* @param day
|
||||||
|
* the occurrence of the day of the week on which daylight
|
||||||
|
* savings time starts.
|
||||||
|
* @param dayOfWeek
|
||||||
|
* the {@code Calendar} day of the week on which daylight savings time
|
||||||
|
* starts.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds on which daylight savings time
|
||||||
|
* starts.
|
||||||
|
*/
|
||||||
|
public void setStartRule(int month, int day, int dayOfWeek, int time) {
|
||||||
|
startMonth = month;
|
||||||
|
startDay = day;
|
||||||
|
startDayOfWeek = dayOfWeek;
|
||||||
|
startTime = time;
|
||||||
|
setStartMode();
|
||||||
|
if (isSimple) {
|
||||||
|
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, day,
|
||||||
|
dayOfWeek, time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the rule which specifies the start of daylight savings time.
|
||||||
|
*
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month in which daylight savings time starts.
|
||||||
|
* @param day
|
||||||
|
* the {@code Calendar} day of the month.
|
||||||
|
* @param dayOfWeek
|
||||||
|
* the {@code Calendar} day of the week on which daylight savings time
|
||||||
|
* starts.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds on which daylight savings time
|
||||||
|
* starts.
|
||||||
|
* @param after
|
||||||
|
* selects the day after or before the day of month.
|
||||||
|
*/
|
||||||
|
public void setStartRule(int month, int day, int dayOfWeek, int time,
|
||||||
|
boolean after) {
|
||||||
|
startMonth = month;
|
||||||
|
startDay = after ? day : -day;
|
||||||
|
startDayOfWeek = -dayOfWeek;
|
||||||
|
startTime = time;
|
||||||
|
setStartMode();
|
||||||
|
if (isSimple) {
|
||||||
|
((com.ibm.icu.util.SimpleTimeZone) icuTZ).setStartRule(month, day,
|
||||||
|
dayOfWeek, time, after);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the starting year for daylight savings time in this {@code SimpleTimeZone}.
|
||||||
|
* Years before this start year will always be in standard time.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* the starting year.
|
||||||
|
*/
|
||||||
|
public void setStartYear(int year) {
|
||||||
|
startYear = year;
|
||||||
|
useDaylight = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the string representation of this {@code SimpleTimeZone}.
|
||||||
|
*
|
||||||
|
* @return the string representation of this {@code SimpleTimeZone}.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return getClass().getName()
|
||||||
|
+ "[id=" //$NON-NLS-1$
|
||||||
|
+ getID()
|
||||||
|
+ ",offset=" //$NON-NLS-1$
|
||||||
|
+ rawOffset
|
||||||
|
+ ",dstSavings=" //$NON-NLS-1$
|
||||||
|
+ dstSavings
|
||||||
|
+ ",useDaylight=" //$NON-NLS-1$
|
||||||
|
+ useDaylight
|
||||||
|
+ ",startYear=" //$NON-NLS-1$
|
||||||
|
+ startYear
|
||||||
|
+ ",startMode=" //$NON-NLS-1$
|
||||||
|
+ startMode
|
||||||
|
+ ",startMonth=" //$NON-NLS-1$
|
||||||
|
+ startMonth
|
||||||
|
+ ",startDay=" //$NON-NLS-1$
|
||||||
|
+ startDay
|
||||||
|
+ ",startDayOfWeek=" //$NON-NLS-1$
|
||||||
|
+ (useDaylight && (startMode != DOM_MODE) ? startDayOfWeek + 1
|
||||||
|
: 0) + ",startTime=" + startTime + ",endMode=" //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ endMode + ",endMonth=" + endMonth + ",endDay=" + endDay //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ ",endDayOfWeek=" //$NON-NLS-1$
|
||||||
|
+ (useDaylight && (endMode != DOM_MODE) ? endDayOfWeek + 1 : 0)
|
||||||
|
+ ",endTime=" + endTime + "]"; //$NON-NLS-1$//$NON-NLS-2$
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean useDaylightTime() {
|
||||||
|
return useDaylight;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final ObjectStreamField[] serialPersistentFields = {
|
||||||
|
new ObjectStreamField("dstSavings", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("endDay", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("endDayOfWeek", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("endMode", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("endMonth", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("endTime", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("monthLength", byte[].class), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("rawOffset", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("serialVersionOnStream", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("startDay", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("startDayOfWeek", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("startMode", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("startMonth", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("startTime", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("startYear", Integer.TYPE), //$NON-NLS-1$
|
||||||
|
new ObjectStreamField("useDaylight", Boolean.TYPE), }; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private void writeObject(ObjectOutputStream stream) throws IOException {
|
||||||
|
int sEndDay = endDay, sEndDayOfWeek = endDayOfWeek + 1, sStartDay = startDay, sStartDayOfWeek = startDayOfWeek + 1;
|
||||||
|
if (useDaylight
|
||||||
|
&& (startMode != DOW_IN_MONTH_MODE || endMode != DOW_IN_MONTH_MODE)) {
|
||||||
|
Calendar cal = new GregorianCalendar(this);
|
||||||
|
if (endMode != DOW_IN_MONTH_MODE) {
|
||||||
|
cal.set(Calendar.MONTH, endMonth);
|
||||||
|
cal.set(Calendar.DATE, endDay);
|
||||||
|
sEndDay = cal.get(Calendar.DAY_OF_WEEK_IN_MONTH);
|
||||||
|
if (endMode == DOM_MODE) {
|
||||||
|
sEndDayOfWeek = cal.getFirstDayOfWeek();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (startMode != DOW_IN_MONTH_MODE) {
|
||||||
|
cal.set(Calendar.MONTH, startMonth);
|
||||||
|
cal.set(Calendar.DATE, startDay);
|
||||||
|
sStartDay = cal.get(Calendar.DAY_OF_WEEK_IN_MONTH);
|
||||||
|
if (startMode == DOM_MODE) {
|
||||||
|
sStartDayOfWeek = cal.getFirstDayOfWeek();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ObjectOutputStream.PutField fields = stream.putFields();
|
||||||
|
fields.put("dstSavings", dstSavings); //$NON-NLS-1$
|
||||||
|
fields.put("endDay", sEndDay); //$NON-NLS-1$
|
||||||
|
fields.put("endDayOfWeek", sEndDayOfWeek); //$NON-NLS-1$
|
||||||
|
fields.put("endMode", endMode); //$NON-NLS-1$
|
||||||
|
fields.put("endMonth", endMonth); //$NON-NLS-1$
|
||||||
|
fields.put("endTime", endTime); //$NON-NLS-1$
|
||||||
|
fields.put("monthLength", GregorianCalendar.DaysInMonth); //$NON-NLS-1$
|
||||||
|
fields.put("rawOffset", rawOffset); //$NON-NLS-1$
|
||||||
|
fields.put("serialVersionOnStream", 1); //$NON-NLS-1$
|
||||||
|
fields.put("startDay", sStartDay); //$NON-NLS-1$
|
||||||
|
fields.put("startDayOfWeek", sStartDayOfWeek); //$NON-NLS-1$
|
||||||
|
fields.put("startMode", startMode); //$NON-NLS-1$
|
||||||
|
fields.put("startMonth", startMonth); //$NON-NLS-1$
|
||||||
|
fields.put("startTime", startTime); //$NON-NLS-1$
|
||||||
|
fields.put("startYear", startYear); //$NON-NLS-1$
|
||||||
|
fields.put("useDaylight", useDaylight); //$NON-NLS-1$
|
||||||
|
stream.writeFields();
|
||||||
|
stream.writeInt(4);
|
||||||
|
byte[] values = new byte[4];
|
||||||
|
values[0] = (byte) startDay;
|
||||||
|
values[1] = (byte) (startMode == DOM_MODE ? 0 : startDayOfWeek + 1);
|
||||||
|
values[2] = (byte) endDay;
|
||||||
|
values[3] = (byte) (endMode == DOM_MODE ? 0 : endDayOfWeek + 1);
|
||||||
|
stream.write(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void readObject(ObjectInputStream stream) throws IOException,
|
||||||
|
ClassNotFoundException {
|
||||||
|
ObjectInputStream.GetField fields = stream.readFields();
|
||||||
|
rawOffset = fields.get("rawOffset", 0); //$NON-NLS-1$
|
||||||
|
useDaylight = fields.get("useDaylight", false); //$NON-NLS-1$
|
||||||
|
if (useDaylight) {
|
||||||
|
endMonth = fields.get("endMonth", 0); //$NON-NLS-1$
|
||||||
|
endTime = fields.get("endTime", 0); //$NON-NLS-1$
|
||||||
|
startMonth = fields.get("startMonth", 0); //$NON-NLS-1$
|
||||||
|
startTime = fields.get("startTime", 0); //$NON-NLS-1$
|
||||||
|
startYear = fields.get("startYear", 0); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
if (fields.get("serialVersionOnStream", 0) == 0) { //$NON-NLS-1$
|
||||||
|
if (useDaylight) {
|
||||||
|
startMode = endMode = DOW_IN_MONTH_MODE;
|
||||||
|
endDay = fields.get("endDay", 0); //$NON-NLS-1$
|
||||||
|
endDayOfWeek = fields.get("endDayOfWeek", 0) - 1; //$NON-NLS-1$
|
||||||
|
startDay = fields.get("startDay", 0); //$NON-NLS-1$
|
||||||
|
startDayOfWeek = fields.get("startDayOfWeek", 0) - 1; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dstSavings = fields.get("dstSavings", 0); //$NON-NLS-1$
|
||||||
|
if (useDaylight) {
|
||||||
|
endMode = fields.get("endMode", 0); //$NON-NLS-1$
|
||||||
|
startMode = fields.get("startMode", 0); //$NON-NLS-1$
|
||||||
|
int length = stream.readInt();
|
||||||
|
byte[] values = new byte[length];
|
||||||
|
stream.readFully(values);
|
||||||
|
if (length >= 4) {
|
||||||
|
startDay = values[0];
|
||||||
|
startDayOfWeek = values[1];
|
||||||
|
if (startMode != DOM_MODE) {
|
||||||
|
startDayOfWeek--;
|
||||||
|
}
|
||||||
|
endDay = values[2];
|
||||||
|
endDayOfWeek = values[3];
|
||||||
|
if (endMode != DOM_MODE) {
|
||||||
|
endDayOfWeek--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,509 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.teavm.classlib.java.util;
|
||||||
|
|
||||||
|
import java.security.AccessController;
|
||||||
|
import java.security.PrivilegedAction;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import org.teavm.classlib.java.io.TSerializable;
|
||||||
|
import org.teavm.classlib.java.lang.TCloneable;
|
||||||
|
|
||||||
|
public abstract class TimeZone implements TSerializable, TCloneable {
|
||||||
|
private static final long serialVersionUID = 3581463369166924961L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The SHORT display name style.
|
||||||
|
*/
|
||||||
|
public static final int SHORT = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The LONG display name style.
|
||||||
|
*/
|
||||||
|
public static final int LONG = 1;
|
||||||
|
|
||||||
|
private static THashMap<String, TimeZone> AvailableZones;
|
||||||
|
|
||||||
|
private static TimeZone Default;
|
||||||
|
|
||||||
|
static TimeZone GMT = new SimpleTimeZone(0, "GMT"); // Greenwich Mean Time
|
||||||
|
|
||||||
|
private String ID;
|
||||||
|
|
||||||
|
private static void initializeAvailable() {
|
||||||
|
TimeZone[] zones = TimeZones.getTimeZones();
|
||||||
|
AvailableZones = new THashMap<>((zones.length + 1) * 4 / 3);
|
||||||
|
AvailableZones.put(GMT.getID(), GMT);
|
||||||
|
for (int i = 0; i < zones.length; i++) {
|
||||||
|
AvailableZones.put(zones[i].getID(), zones[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TimeZone() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object clone() {
|
||||||
|
try {
|
||||||
|
TimeZone zone = (TimeZone) super.clone();
|
||||||
|
return zone;
|
||||||
|
} catch (CloneNotSupportedException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized String[] getAvailableIDs() {
|
||||||
|
return AvailableZones.keySet().toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized String[] getAvailableIDs(int offset) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
for (TIterator<TimeZone> iter = AvailableZones.values().iterator(); iter.hasNext()) {
|
||||||
|
if ()
|
||||||
|
}
|
||||||
|
return Arrays.copyOf(result, j);
|
||||||
|
int count = 0;
|
||||||
|
int length = availableIDs.length;
|
||||||
|
String[] all = new String[length];
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
if (tz.getRawOffset() == offset) {
|
||||||
|
all[count++] = tz.getID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String[] answer = new String[count];
|
||||||
|
System.arraycopy(all, 0, answer, 0, count);
|
||||||
|
return answer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the default time zone.
|
||||||
|
*
|
||||||
|
* @return the default time zone.
|
||||||
|
*/
|
||||||
|
public static synchronized TimeZone getDefault() {
|
||||||
|
if (Default == null) {
|
||||||
|
setDefault(null);
|
||||||
|
}
|
||||||
|
return (TimeZone) Default.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the LONG name for this {@code TimeZone} for the default {@code Locale} in standard
|
||||||
|
* time. If the name is not available, the result is in the format
|
||||||
|
* {@code GMT[+-]hh:mm}.
|
||||||
|
*
|
||||||
|
* @return the {@code TimeZone} name.
|
||||||
|
*/
|
||||||
|
public final String getDisplayName() {
|
||||||
|
return getDisplayName(false, LONG, Locale.getDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the LONG name for this {@code TimeZone} for the specified {@code Locale} in standard
|
||||||
|
* time. If the name is not available, the result is in the format
|
||||||
|
* {@code GMT[+-]hh:mm}.
|
||||||
|
*
|
||||||
|
* @param locale
|
||||||
|
* the {@code Locale}.
|
||||||
|
* @return the {@code TimeZone} name.
|
||||||
|
*/
|
||||||
|
public final String getDisplayName(Locale locale) {
|
||||||
|
return getDisplayName(false, LONG, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the specified style of name ({@code LONG} or {@code SHORT}) for this {@code TimeZone} for
|
||||||
|
* the default {@code Locale} in either standard or daylight time as specified. If
|
||||||
|
* the name is not available, the result is in the format {@code GMT[+-]hh:mm}.
|
||||||
|
*
|
||||||
|
* @param daylightTime
|
||||||
|
* {@code true} for daylight time, {@code false} for standard
|
||||||
|
* time.
|
||||||
|
* @param style
|
||||||
|
* either {@code LONG} or {@code SHORT}.
|
||||||
|
* @return the {@code TimeZone} name.
|
||||||
|
*/
|
||||||
|
public final String getDisplayName(boolean daylightTime, int style) {
|
||||||
|
return getDisplayName(daylightTime, style, Locale.getDefault());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the specified style of name ({@code LONG} or {@code SHORT}) for this {@code TimeZone} for
|
||||||
|
* the specified {@code Locale} in either standard or daylight time as specified. If
|
||||||
|
* the name is not available, the result is in the format {@code GMT[+-]hh:mm}.
|
||||||
|
*
|
||||||
|
* @param daylightTime
|
||||||
|
* {@code true} for daylight time, {@code false} for standard
|
||||||
|
* time.
|
||||||
|
* @param style
|
||||||
|
* either LONG or SHORT.
|
||||||
|
* @param locale
|
||||||
|
* either {@code LONG} or {@code SHORT}.
|
||||||
|
* @return the {@code TimeZone} name.
|
||||||
|
*/
|
||||||
|
public String getDisplayName(boolean daylightTime, int style, Locale locale) {
|
||||||
|
if(icuTimeZone == null || !ID.equals(icuTimeZone.getID())){
|
||||||
|
icuTimeZone = com.ibm.icu.util.TimeZone.getTimeZone(ID);
|
||||||
|
}
|
||||||
|
return icuTimeZone.getDisplayName(
|
||||||
|
daylightTime, style, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the ID of this {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @return the time zone ID string.
|
||||||
|
*/
|
||||||
|
public String getID() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the daylight savings offset in milliseconds for this {@code TimeZone}.
|
||||||
|
* <p>
|
||||||
|
* This implementation returns 3600000 (1 hour), or 0 if the time zone does
|
||||||
|
* not observe daylight savings.
|
||||||
|
* <p>
|
||||||
|
* Subclasses may override to return daylight savings values other than 1
|
||||||
|
* hour.
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* @return the daylight savings offset in milliseconds if this {@code TimeZone}
|
||||||
|
* observes daylight savings, zero otherwise.
|
||||||
|
*/
|
||||||
|
public int getDSTSavings() {
|
||||||
|
if (useDaylightTime()) {
|
||||||
|
return 3600000;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the offset from GMT of this {@code TimeZone} for the specified date. The
|
||||||
|
* offset includes daylight savings time if the specified date is within the
|
||||||
|
* daylight savings time period.
|
||||||
|
*
|
||||||
|
* @param time
|
||||||
|
* the date in milliseconds since January 1, 1970 00:00:00 GMT
|
||||||
|
* @return the offset from GMT in milliseconds.
|
||||||
|
*/
|
||||||
|
public int getOffset(long time) {
|
||||||
|
if (inDaylightTime(new Date(time))) {
|
||||||
|
return getRawOffset() + getDSTSavings();
|
||||||
|
}
|
||||||
|
return getRawOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the offset from GMT of this {@code TimeZone} for the specified date and
|
||||||
|
* time. The offset includes daylight savings time if the specified date and
|
||||||
|
* time are within the daylight savings time period.
|
||||||
|
*
|
||||||
|
* @param era
|
||||||
|
* the {@code GregorianCalendar} era, either {@code GregorianCalendar.BC} or
|
||||||
|
* {@code GregorianCalendar.AD}.
|
||||||
|
* @param year
|
||||||
|
* the year.
|
||||||
|
* @param month
|
||||||
|
* the {@code Calendar} month.
|
||||||
|
* @param day
|
||||||
|
* the day of the month.
|
||||||
|
* @param dayOfWeek
|
||||||
|
* the {@code Calendar} day of the week.
|
||||||
|
* @param time
|
||||||
|
* the time of day in milliseconds.
|
||||||
|
* @return the offset from GMT in milliseconds.
|
||||||
|
*/
|
||||||
|
abstract public int getOffset(int era, int year, int month, int day,
|
||||||
|
int dayOfWeek, int time);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the offset for standard time from GMT for this {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @return the offset from GMT in milliseconds.
|
||||||
|
*/
|
||||||
|
abstract public int getRawOffset();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the {@code TimeZone} with the specified ID.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* a time zone string ID.
|
||||||
|
* @return the {@code TimeZone} with the specified ID or null if no {@code TimeZone} with
|
||||||
|
* the specified ID exists.
|
||||||
|
*/
|
||||||
|
public static synchronized TimeZone getTimeZone(String name) {
|
||||||
|
if (AvailableZones == null) {
|
||||||
|
initializeAvailable();
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeZone zone = AvailableZones.get(name);
|
||||||
|
if(zone == null && isAvailableIDInICU(name)){
|
||||||
|
appendAvailableZones(name);
|
||||||
|
zone = AvailableZones.get(name);
|
||||||
|
}
|
||||||
|
if (zone == null) {
|
||||||
|
if (name.startsWith("GMT") && name.length() > 3) {
|
||||||
|
char sign = name.charAt(3);
|
||||||
|
if (sign == '+' || sign == '-') {
|
||||||
|
int[] position = new int[1];
|
||||||
|
String formattedName = formatTimeZoneName(name, 4);
|
||||||
|
int hour = parseNumber(formattedName, 4, position);
|
||||||
|
if (hour < 0 || hour > 23) {
|
||||||
|
return (TimeZone) GMT.clone();
|
||||||
|
}
|
||||||
|
int index = position[0];
|
||||||
|
if (index != -1) {
|
||||||
|
int raw = hour * 3600000;
|
||||||
|
if (index < formattedName.length()
|
||||||
|
&& formattedName.charAt(index) == ':') {
|
||||||
|
int minute = parseNumber(formattedName, index + 1,
|
||||||
|
position);
|
||||||
|
if (position[0] == -1 || minute < 0 || minute > 59) {
|
||||||
|
return (TimeZone) GMT.clone();
|
||||||
|
}
|
||||||
|
raw += minute * 60000;
|
||||||
|
} else if (hour >= 30 || index > 6) {
|
||||||
|
raw = (hour / 100 * 3600000) + (hour % 100 * 60000);
|
||||||
|
}
|
||||||
|
if (sign == '-') {
|
||||||
|
raw = -raw;
|
||||||
|
}
|
||||||
|
return new SimpleTimeZone(raw, formattedName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
zone = GMT;
|
||||||
|
}
|
||||||
|
return (TimeZone) zone.clone();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String formatTimeZoneName(String name, int offset) {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
int index = offset, length = name.length();
|
||||||
|
buf.append(name.substring(0, offset));
|
||||||
|
|
||||||
|
while (index < length) {
|
||||||
|
if (Character.digit(name.charAt(index), 10) != -1) {
|
||||||
|
buf.append(name.charAt(index));
|
||||||
|
if ((length - (index + 1)) == 2) {
|
||||||
|
buf.append(':');
|
||||||
|
}
|
||||||
|
} else if (name.charAt(index) == ':') {
|
||||||
|
buf.append(':');
|
||||||
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf.toString().indexOf(":") == -1) {
|
||||||
|
buf.append(':');
|
||||||
|
buf.append("00");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buf.toString().indexOf(":") == 5) {
|
||||||
|
buf.insert(4, '0');
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the specified {@code TimeZone} has the same raw offset as this
|
||||||
|
* {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param zone
|
||||||
|
* a {@code TimeZone}.
|
||||||
|
* @return {@code true} when the {@code TimeZone} have the same raw offset, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
public boolean hasSameRules(TimeZone zone) {
|
||||||
|
if (zone == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getRawOffset() == zone.getRawOffset();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the specified {@code Date} is in the daylight savings time period for
|
||||||
|
* this {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param time
|
||||||
|
* a {@code Date}.
|
||||||
|
* @return {@code true} when the {@code Date} is in the daylight savings time period, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
abstract public boolean inDaylightTime(Date time);
|
||||||
|
|
||||||
|
private static int parseNumber(String string, int offset, int[] position) {
|
||||||
|
int index = offset, length = string.length(), digit, result = 0;
|
||||||
|
while (index < length
|
||||||
|
&& (digit = Character.digit(string.charAt(index), 10)) != -1) {
|
||||||
|
index++;
|
||||||
|
result = result * 10 + digit;
|
||||||
|
}
|
||||||
|
position[0] = index == offset ? -1 : index;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the default time zone. If passed {@code null}, then the next
|
||||||
|
* time {@link #getDefault} is called, the default time zone will be
|
||||||
|
* determined. This behavior is slightly different than the canonical
|
||||||
|
* description of this method, but it follows the spirit of it.
|
||||||
|
*
|
||||||
|
* @param timezone
|
||||||
|
* a {@code TimeZone} object.
|
||||||
|
*/
|
||||||
|
public static synchronized void setDefault(TimeZone timezone) {
|
||||||
|
if (timezone != null) {
|
||||||
|
setICUDefaultTimeZone(timezone);
|
||||||
|
Default = timezone;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String zone = AccessController.doPrivileged(new PriviAction<String>(
|
||||||
|
"user.timezone"));
|
||||||
|
|
||||||
|
// sometimes DRLVM incorrectly adds "\n" to the end of timezone ID
|
||||||
|
if (zone != null && zone.contains("\n")) {
|
||||||
|
zone = zone.substring(0, zone.indexOf("\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// if property user.timezone is not set, we call the native method
|
||||||
|
// getCustomTimeZone
|
||||||
|
if (zone == null || zone.length() == 0) {
|
||||||
|
int[] tzinfo = new int[10];
|
||||||
|
boolean[] isCustomTimeZone = new boolean[1];
|
||||||
|
|
||||||
|
String zoneId = getCustomTimeZone(tzinfo, isCustomTimeZone);
|
||||||
|
|
||||||
|
// if returned TimeZone is a user customized TimeZone
|
||||||
|
if (isCustomTimeZone[0]) {
|
||||||
|
// build a new SimpleTimeZone
|
||||||
|
switch (tzinfo[1]) {
|
||||||
|
case 0:
|
||||||
|
// does not observe DST
|
||||||
|
Default = new SimpleTimeZone(tzinfo[0], zoneId);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// observes DST
|
||||||
|
Default = new SimpleTimeZone(tzinfo[0], zoneId, tzinfo[5],
|
||||||
|
tzinfo[4], tzinfo[3], tzinfo[2], tzinfo[9],
|
||||||
|
tzinfo[8], tzinfo[7], tzinfo[6], tzinfo[1]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// get TimeZone
|
||||||
|
Default = getTimeZone(zoneId);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if property user.timezone is set in command line (with -D option)
|
||||||
|
Default = getTimeZone(zone);
|
||||||
|
}
|
||||||
|
setICUDefaultTimeZone(Default);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setICUDefaultTimeZone(TimeZone timezone) {
|
||||||
|
final com.ibm.icu.util.TimeZone icuTZ = com.ibm.icu.util.TimeZone
|
||||||
|
.getTimeZone(timezone.getID());
|
||||||
|
|
||||||
|
AccessController
|
||||||
|
.doPrivileged(new PrivilegedAction<java.lang.reflect.Field>() {
|
||||||
|
public java.lang.reflect.Field run() {
|
||||||
|
java.lang.reflect.Field field = null;
|
||||||
|
try {
|
||||||
|
field = com.ibm.icu.util.TimeZone.class
|
||||||
|
.getDeclaredField("defaultZone");
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set("defaultZone", icuTZ);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the ID of this {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* a string which is the time zone ID.
|
||||||
|
*/
|
||||||
|
public void setID(String name) {
|
||||||
|
if (name == null) {
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
ID = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the offset for standard time from GMT for this {@code TimeZone}.
|
||||||
|
*
|
||||||
|
* @param offset
|
||||||
|
* the offset from GMT in milliseconds.
|
||||||
|
*/
|
||||||
|
abstract public void setRawOffset(int offset);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether this {@code TimeZone} has a daylight savings time period.
|
||||||
|
*
|
||||||
|
* @return {@code true} if this {@code TimeZone} has a daylight savings time period, {@code false}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
abstract public boolean useDaylightTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the name and the details of the user-selected TimeZone on the
|
||||||
|
* device.
|
||||||
|
*
|
||||||
|
* @param tzinfo
|
||||||
|
* int array of 10 elements to be filled with the TimeZone
|
||||||
|
* information. Once filled, the contents of the array are
|
||||||
|
* formatted as follows: tzinfo[0] -> the timezone offset;
|
||||||
|
* tzinfo[1] -> the dst adjustment; tzinfo[2] -> the dst start
|
||||||
|
* hour; tzinfo[3] -> the dst start day of week; tzinfo[4] -> the
|
||||||
|
* dst start week of month; tzinfo[5] -> the dst start month;
|
||||||
|
* tzinfo[6] -> the dst end hour; tzinfo[7] -> the dst end day of
|
||||||
|
* week; tzinfo[8] -> the dst end week of month; tzinfo[9] -> the
|
||||||
|
* dst end month;
|
||||||
|
* @param isCustomTimeZone
|
||||||
|
* boolean array of size 1 that indicates if a timezone match is
|
||||||
|
* found
|
||||||
|
* @return the name of the TimeZone or null if error occurs in native
|
||||||
|
* method.
|
||||||
|
*/
|
||||||
|
private static native String getCustomTimeZone(int[] tzinfo,
|
||||||
|
boolean[] isCustomTimeZone);
|
||||||
|
}
|
|
@ -0,0 +1,707 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.teavm.classlib.java.util;
|
||||||
|
|
||||||
|
final class TimeZones {
|
||||||
|
|
||||||
|
private static final int HALF_HOUR = 1800000;
|
||||||
|
private static final int ONE_HOUR = HALF_HOUR * 2;
|
||||||
|
|
||||||
|
public static TimeZone[] getTimeZones() {
|
||||||
|
return new TimeZone[] {
|
||||||
|
new SimpleTimeZone(-11 * ONE_HOUR, "MIT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-10 * ONE_HOUR, "HST"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-9 * ONE_HOUR, "AST", Calendar.APRIL, 1, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-8 * ONE_HOUR, "PST", Calendar.APRIL, 1, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR, "MST", Calendar.APRIL, 1, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR, "PNT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "CST", Calendar.APRIL, 1, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "EST", Calendar.APRIL, 1, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "IET"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "PRT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR - 1800000,
|
||||||
|
"CNT", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 60000,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000),
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "AGT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "BET", Calendar.OCTOBER, 8, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.FEBRUARY, 15,
|
||||||
|
-Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "UTC"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "WET", Calendar.MARCH, -1, //$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "ECT", Calendar.MARCH, -1, //$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "MET", Calendar.MARCH, 21, 0, //$NON-NLS-1$
|
||||||
|
0 * ONE_HOUR, Calendar.SEPTEMBER, 23, 0, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "ART", Calendar.APRIL, -1, //$NON-NLS-1$
|
||||||
|
Calendar.FRIDAY, 0 * ONE_HOUR, Calendar.SEPTEMBER, -1,
|
||||||
|
Calendar.THURSDAY, 23 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "CAT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "EET", Calendar.MARCH, -1, //$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "EAT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR + 1800000,
|
||||||
|
"Asia/Tehran", //$NON-NLS-1$
|
||||||
|
Calendar.MARCH, 21, 0, 0 * ONE_HOUR,
|
||||||
|
Calendar.SEPTEMBER, 23, 0, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "NET", Calendar.MARCH, -1, //$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "PLT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR + 1800000, "IST"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "BST"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "VST"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "CTT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR, "JST"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR + 1800000, "ACT"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "AET", Calendar.OCTOBER, -1, //$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR, "SST"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "NST", Calendar.OCTOBER, 1, //$NON-NLS-1$
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, 15,
|
||||||
|
-Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "America/Costa_Rica"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"America/Halifax", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-2 * ONE_HOUR, "Atlantic/South_Georgia"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR,
|
||||||
|
"Europe/London", //$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Algiers"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(
|
||||||
|
2 * ONE_HOUR,
|
||||||
|
"Africa/Cairo", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, -1, Calendar.FRIDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.SEPTEMBER, -1, Calendar.THURSDAY,
|
||||||
|
23 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Harare"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Asia/Jerusalem", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 9, 0, 1 * ONE_HOUR, Calendar.SEPTEMBER,
|
||||||
|
24, 0, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Bucharest", //$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR,
|
||||||
|
"Europe/Moscow", //$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR + 1800000, "Asia/Kabul"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR + 1800000,
|
||||||
|
"Australia/Adelaide", Calendar.OCTOBER, -1, //$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "Australia/Brisbane"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR,
|
||||||
|
"Australia/Hobart", //$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
|
||||||
|
new SimpleTimeZone(-9 * ONE_HOUR - 1800000, "Pacific/Marquesas"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-1 * ONE_HOUR,
|
||||||
|
"Atlantic/Azores", //$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Dubai"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(20700000, "Asia/Katmandu"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR + 1800000, "Asia/Rangoon"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(45900000,
|
||||||
|
"Pacific/Chatham", //$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 9900000,
|
||||||
|
Calendar.MARCH, 15, -Calendar.SUNDAY, 9900000),
|
||||||
|
|
||||||
|
new SimpleTimeZone(-11 * ONE_HOUR, "Pacific/Apia"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-11 * ONE_HOUR, "Pacific/Niue"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-11 * ONE_HOUR, "Pacific/Pago_Pago"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-10 * ONE_HOUR,
|
||||||
|
"America/Adak", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Fakaofo"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Honolulu"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Rarotonga"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-10 * ONE_HOUR, "Pacific/Tahiti"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-9 * ONE_HOUR,
|
||||||
|
"America/Anchorage", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-9 * ONE_HOUR, "Pacific/Gambier"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-8 * ONE_HOUR,
|
||||||
|
"America/Los_Angeles", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-8 * ONE_HOUR,
|
||||||
|
"America/Tijuana", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-8 * ONE_HOUR,
|
||||||
|
"America/Vancouver", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-8 * ONE_HOUR, "Pacific/Pitcairn"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR, "America/Dawson_Creek"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR,
|
||||||
|
"America/Denver", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR,
|
||||||
|
"America/Edmonton", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR,
|
||||||
|
"America/Mazatlan", //$NON-NLS-1$
|
||||||
|
Calendar.MAY, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.SEPTEMBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-7 * ONE_HOUR, "America/Phoenix"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "America/Belize"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR,
|
||||||
|
"America/Chicago", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "America/El_Salvador"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "America/Managua"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR,
|
||||||
|
"America/Mexico_City", //$NON-NLS-1$
|
||||||
|
Calendar.MAY, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.SEPTEMBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "America/Regina"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "America/Tegucigalpa"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR,
|
||||||
|
"America/Winnipeg", //$NON-NLS-1$ //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR,
|
||||||
|
"Pacific/Easter", //$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 4 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, 9, -Calendar.SUNDAY, 3 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-6 * ONE_HOUR, "Pacific/Galapagos"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Bogota"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Cayman"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR,
|
||||||
|
"America/Grand_Turk",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Guayaquil"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR,
|
||||||
|
"America/Havana", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Indianapolis"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Jamaica"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Lima"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR,
|
||||||
|
"America/Montreal", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR,
|
||||||
|
"America/Nassau", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR,
|
||||||
|
"America/New_York", //$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Panama"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Port-au-Prince"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Porto_Acre"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-5 * ONE_HOUR, "America/Rio_Branco"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Anguilla"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Antigua"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Aruba"), //$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"America/Asuncion", //$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, 1, -Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Barbados"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Caracas"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"America/Cuiaba",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 8, -Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.FEBRUARY, 15, -Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Curacao"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Dominica"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Grenada"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Guadeloupe"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Guyana"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/La_Paz"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Manaus"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Martinique"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Montserrat"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Port_of_Spain"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Puerto_Rico"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"America/Santiago",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 4 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, 9, -Calendar.SUNDAY, 3 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Santo_Domingo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Kitts"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Lucia"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Thomas"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/St_Vincent"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"America/Thule",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR, "America/Tortola"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"Antarctica/Palmer",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"Atlantic/Bermuda",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-4 * ONE_HOUR,
|
||||||
|
"Atlantic/Stanley",//$NON-NLS-1$
|
||||||
|
Calendar.SEPTEMBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.APRIL, 15, -Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR - 1800000,
|
||||||
|
"America/St_Johns",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 60000,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000),
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "America/Buenos_Aires"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "America/Cayenne"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "America/Fortaleza"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR,
|
||||||
|
"America/Godthab",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR,
|
||||||
|
"America/Miquelon",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "America/Montevideo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR, "America/Paramaribo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-3 * ONE_HOUR,
|
||||||
|
"America/Sao_Paulo",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 8, -Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.FEBRUARY, 15, -Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-2 * ONE_HOUR, "America/Noronha"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(-1 * ONE_HOUR,
|
||||||
|
"America/Scoresbysund",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(-1 * ONE_HOUR, "Atlantic/Cape_Verde"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Abidjan"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Accra"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Banjul"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Bissau"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Casablanca"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Conakry"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Dakar"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Freetown"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Lome"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Monrovia"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Nouakchott"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Ouagadougou"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Sao_Tome"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Africa/Timbuktu"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR,
|
||||||
|
"Atlantic/Canary",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR,
|
||||||
|
"Atlantic/Faeroe",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Atlantic/Reykjavik"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR, "Atlantic/St_Helena"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR,
|
||||||
|
"Europe/Dublin",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(0 * ONE_HOUR,
|
||||||
|
"Europe/Lisbon",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Bangui"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Douala"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Kinshasa"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Lagos"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Libreville"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Luanda"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Malabo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Ndjamena"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Niamey"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Porto-Novo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Africa/Tunis"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Africa/Windhoek",//$NON-NLS-1$
|
||||||
|
Calendar.SEPTEMBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.APRIL, 1, -Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Atlantic/Jan_Mayen"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Amsterdam",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Andorra",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Belgrade",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Berlin",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Brussels",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Budapest",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Copenhagen",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Gibraltar",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Luxembourg",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Madrid",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Malta",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Monaco",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Europe/Oslo", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Paris",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Prague",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR, "Europe/Rome", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Stockholm",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Tirane",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Vaduz",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Vienna",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Warsaw",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(1 * ONE_HOUR,
|
||||||
|
"Europe/Zurich",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Blantyre"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Bujumbura"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Gaborone"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Johannesburg"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Kigali"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Lubumbashi"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Lusaka"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Maputo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Maseru"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Mbabane"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Africa/Tripoli"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Asia/Amman", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.THURSDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Asia/Beirut", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Asia/Damascus",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, 0, 0 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
1, 0, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Asia/Nicosia",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Athens",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Chisinau",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Helsinki",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Istanbul",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Kaliningrad",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Kiev", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Minsk",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Riga", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Simferopol",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR,
|
||||||
|
"Europe/Sofia",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 1 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Tallinn"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(2 * ONE_HOUR, "Europe/Vilnius"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Addis_Ababa"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Asmera"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Dar_es_Salaam"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Djibouti"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Kampala"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Khartoum"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Mogadishu"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Africa/Nairobi"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Aden"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR,
|
||||||
|
"Asia/Baghdad",//$NON-NLS-1$
|
||||||
|
Calendar.APRIL, 1, 0, 3 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
1, 0, 3 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Bahrain"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Kuwait"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Qatar"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Asia/Riyadh"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Indian/Antananarivo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Indian/Comoro"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(3 * ONE_HOUR, "Indian/Mayotte"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Aqtau", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Baku", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 1 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Asia/Muscat"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR,
|
||||||
|
"Asia/Tbilisi",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 0 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR,
|
||||||
|
"Asia/Yerevan",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR,
|
||||||
|
"Europe/Samara",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Indian/Mahe"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Indian/Mauritius"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(4 * ONE_HOUR, "Indian/Reunion"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Aqtobe", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Ashgabat"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Ashkhabad"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(
|
||||||
|
5 * ONE_HOUR,
|
||||||
|
"Asia/Bishkek",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY,
|
||||||
|
2 * ONE_HOUR + 1800000, Calendar.OCTOBER, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR + 1800000),
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Dushanbe"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Karachi"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Asia/Tashkent"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR,
|
||||||
|
"Asia/Yekaterinburg",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Indian/Kerguelen"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR, "Indian/Maldives"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR + 1800000, "Asia/Calcutta"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Antarctica/Mawson"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Almaty", Calendar.MARCH,//$NON-NLS-1$
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR, Calendar.OCTOBER,
|
||||||
|
-1, Calendar.SUNDAY, 0 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(5 * ONE_HOUR + HALF_HOUR, "Asia/Colombo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Dacca"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Dhaka"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR,
|
||||||
|
"Asia/Novosibirsk",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Thimbu"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Asia/Thimphu"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR, "Indian/Chagos"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(6 * ONE_HOUR + 1800000, "Indian/Cocos"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Bangkok"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Jakarta"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR,
|
||||||
|
"Asia/Krasnoyarsk",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Phnom_Penh"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Saigon"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "Asia/Vientiane"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(7 * ONE_HOUR, "Indian/Christmas"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Antarctica/Casey"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Brunei"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Hong_Kong"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR,
|
||||||
|
"Asia/Irkutsk",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Kuala_Lumpur"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Macao"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Manila"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Shanghai"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Singapore"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Taipei"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Ujung_Pandang"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Ulaanbaatar"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Asia/Ulan_Bator"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(8 * ONE_HOUR, "Australia/Perth"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Jayapura"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Pyongyang"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Seoul"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR, "Asia/Tokyo"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR,
|
||||||
|
"Asia/Yakutsk",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR, "Pacific/Palau"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR + 1800000,
|
||||||
|
"Australia/Broken_Hill", Calendar.OCTOBER, -1,//$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(9 * ONE_HOUR + 1800000, "Australia/Darwin"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "Antarctica/DumontDUrville"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR,
|
||||||
|
"Asia/Vladivostok",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR,
|
||||||
|
"Australia/Sydney",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Guam"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Port_Moresby"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Saipan"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR, "Pacific/Truk"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(10 * ONE_HOUR + 1800000,
|
||||||
|
"Australia/Lord_Howe", Calendar.OCTOBER, -1,//$NON-NLS-1$
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR, Calendar.MARCH, -1,
|
||||||
|
Calendar.SUNDAY, 2 * ONE_HOUR, 1800000),
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR,
|
||||||
|
"Asia/Magadan",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Efate"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Guadalcanal"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Kosrae"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Noumea"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR, "Pacific/Ponape"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(11 * ONE_HOUR + 1800000, "Pacific/Norfolk"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR,
|
||||||
|
"Antarctica/McMurdo",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, 15, -Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR,
|
||||||
|
"Asia/Anadyr",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR,
|
||||||
|
"Asia/Kamchatka",//$NON-NLS-1$
|
||||||
|
Calendar.MARCH, -1, Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR,
|
||||||
|
"Pacific/Auckland",//$NON-NLS-1$
|
||||||
|
Calendar.OCTOBER, 1, -Calendar.SUNDAY, 2 * ONE_HOUR,
|
||||||
|
Calendar.MARCH, 15, -Calendar.SUNDAY, 2 * ONE_HOUR),
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Fiji"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Funafuti"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Majuro"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Nauru"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Tarawa"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Wake"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(12 * ONE_HOUR, "Pacific/Wallis"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(13 * ONE_HOUR, "Pacific/Enderbury"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(13 * ONE_HOUR, "Pacific/Tongatapu"),//$NON-NLS-1$
|
||||||
|
new SimpleTimeZone(14 * ONE_HOUR, "Pacific/Kiritimati"), };//$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user