1 | /* java.util.TimeZone
|
---|
2 | Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
---|
3 |
|
---|
4 | This file is part of GNU Classpath.
|
---|
5 |
|
---|
6 | GNU Classpath is free software; you can redistribute it and/or modify
|
---|
7 | it under the terms of the GNU General Public License as published by
|
---|
8 | the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | any later version.
|
---|
10 |
|
---|
11 | GNU Classpath is distributed in the hope that it will be useful, but
|
---|
12 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | General Public License for more details.
|
---|
15 |
|
---|
16 | You should have received a copy of the GNU General Public License
|
---|
17 | along with GNU Classpath; see the file COPYING. If not, write to the
|
---|
18 | Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
---|
19 | 02111-1307 USA.
|
---|
20 |
|
---|
21 | Linking this library statically or dynamically with other modules is
|
---|
22 | making a combined work based on this library. Thus, the terms and
|
---|
23 | conditions of the GNU General Public License cover the whole
|
---|
24 | combination.
|
---|
25 |
|
---|
26 | As a special exception, the copyright holders of this library give you
|
---|
27 | permission to link this library with independent modules to produce an
|
---|
28 | executable, regardless of the license terms of these independent
|
---|
29 | modules, and to copy and distribute the resulting executable under
|
---|
30 | terms of your choice, provided that you also meet, for each linked
|
---|
31 | independent module, the terms and conditions of the license of that
|
---|
32 | module. An independent module is a module which is not derived from
|
---|
33 | or based on this library. If you modify this library, you may extend
|
---|
34 | this exception to your version of the library, but you are not
|
---|
35 | obligated to do so. If you do not wish to do so, delete this
|
---|
36 | exception statement from your version. */
|
---|
37 |
|
---|
38 |
|
---|
39 | package java.util;
|
---|
40 | import java.text.DateFormatSymbols;
|
---|
41 | import gnu.classpath.Configuration;
|
---|
42 |
|
---|
43 | /**
|
---|
44 | * This class represents a time zone offset and handles daylight savings.
|
---|
45 | *
|
---|
46 | * You can get the default time zone with <code>getDefault</code>.
|
---|
47 | * This represents the time zone where program is running.
|
---|
48 | *
|
---|
49 | * Another way to create a time zone is <code>getTimeZone</code>, where
|
---|
50 | * you can give an identifier as parameter. For instance, the identifier
|
---|
51 | * of the Central European Time zone is "CET".
|
---|
52 | *
|
---|
53 | * With the <code>getAvailableIDs</code> method, you can get all the
|
---|
54 | * supported time zone identifiers.
|
---|
55 | *
|
---|
56 | * @see Calendar
|
---|
57 | * @see SimpleTimeZone
|
---|
58 | * @author Jochen Hoenicke
|
---|
59 | */
|
---|
60 | public abstract class TimeZone implements java.io.Serializable, Cloneable
|
---|
61 | {
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Constant used to indicate that a short timezone abbreviation should
|
---|
65 | * be returned, such as "EST"
|
---|
66 | */
|
---|
67 | public static final int SHORT = 0;
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Constant used to indicate that a long timezone name should be
|
---|
71 | * returned, such as "Eastern Standard Time".
|
---|
72 | */
|
---|
73 | public static final int LONG = 1;
|
---|
74 |
|
---|
75 | /**
|
---|
76 | * The time zone identifier, e.g. PST.
|
---|
77 | */
|
---|
78 | private String ID;
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * The default time zone, as returned by getDefault.
|
---|
82 | */
|
---|
83 | private static TimeZone defaultZone;
|
---|
84 |
|
---|
85 | private static final long serialVersionUID = 3581463369166924961L;
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Hashtable for timezones by ID.
|
---|
89 | */
|
---|
90 | private static final Hashtable timezones = new Hashtable();
|
---|
91 |
|
---|
92 | static
|
---|
93 | {
|
---|
94 | TimeZone tz;
|
---|
95 | // Automatically generated by scripts/timezones.pl
|
---|
96 | // XXX - Should we read this data from a file?
|
---|
97 | tz = new SimpleTimeZone(-11000 * 3600, "MIT");
|
---|
98 | timezones.put("MIT", tz);
|
---|
99 | timezones.put("Pacific/Apia", tz);
|
---|
100 | timezones.put("Pacific/Midway", tz);
|
---|
101 | timezones.put("Pacific/Niue", tz);
|
---|
102 | timezones.put("Pacific/Pago_Pago", tz);
|
---|
103 | tz = new SimpleTimeZone
|
---|
104 | (-10000 * 3600, "America/Adak",
|
---|
105 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
106 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
107 | timezones.put("America/Adak", tz);
|
---|
108 | tz = new SimpleTimeZone(-10000 * 3600, "HST");
|
---|
109 | timezones.put("HST", tz);
|
---|
110 | timezones.put("Pacific/Fakaofo", tz);
|
---|
111 | timezones.put("Pacific/Honolulu", tz);
|
---|
112 | timezones.put("Pacific/Johnston", tz);
|
---|
113 | timezones.put("Pacific/Rarotonga", tz);
|
---|
114 | timezones.put("Pacific/Tahiti", tz);
|
---|
115 | tz = new SimpleTimeZone(-9500 * 3600, "Pacific/Marquesas");
|
---|
116 | timezones.put("Pacific/Marquesas", tz);
|
---|
117 | tz = new SimpleTimeZone
|
---|
118 | (-9000 * 3600, "AST",
|
---|
119 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
120 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
121 | timezones.put("AST", tz);
|
---|
122 | timezones.put("America/Anchorage", tz);
|
---|
123 | timezones.put("America/Juneau", tz);
|
---|
124 | timezones.put("America/Nome", tz);
|
---|
125 | timezones.put("America/Yakutat", tz);
|
---|
126 | tz = new SimpleTimeZone(-9000 * 3600, "Pacific/Gambier");
|
---|
127 | timezones.put("Pacific/Gambier", tz);
|
---|
128 | tz = new SimpleTimeZone
|
---|
129 | (-8000 * 3600, "PST",
|
---|
130 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
131 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
132 | timezones.put("PST", tz);
|
---|
133 | timezones.put("PST8PDT", tz);
|
---|
134 | timezones.put("America/Dawson", tz);
|
---|
135 | timezones.put("America/Los_Angeles", tz);
|
---|
136 | timezones.put("America/Tijuana", tz);
|
---|
137 | timezones.put("America/Vancouver", tz);
|
---|
138 | timezones.put("America/Whitehorse", tz);
|
---|
139 | timezones.put("US/Pacific-New", tz);
|
---|
140 | tz = new SimpleTimeZone(-8000 * 3600, "Pacific/Pitcairn");
|
---|
141 | timezones.put("Pacific/Pitcairn", tz);
|
---|
142 | tz = new SimpleTimeZone
|
---|
143 | (-7000 * 3600, "MST",
|
---|
144 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
145 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
146 | timezones.put("MST", tz);
|
---|
147 | timezones.put("MST7MDT", tz);
|
---|
148 | timezones.put("America/Boise", tz);
|
---|
149 | timezones.put("America/Chihuahua", tz);
|
---|
150 | timezones.put("America/Denver", tz);
|
---|
151 | timezones.put("America/Edmonton", tz);
|
---|
152 | timezones.put("America/Inuvik", tz);
|
---|
153 | timezones.put("America/Mazatlan", tz);
|
---|
154 | timezones.put("America/Shiprock", tz);
|
---|
155 | timezones.put("America/Yellowknife", tz);
|
---|
156 | tz = new SimpleTimeZone(-7000 * 3600, "MST7");
|
---|
157 | timezones.put("MST7", tz);
|
---|
158 | timezones.put("PNT", tz);
|
---|
159 | timezones.put("America/Dawson_Creek", tz);
|
---|
160 | timezones.put("America/Hermosillo", tz);
|
---|
161 | timezones.put("America/Phoenix", tz);
|
---|
162 | tz = new SimpleTimeZone
|
---|
163 | (-6000 * 3600, "CST",
|
---|
164 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
165 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
166 | timezones.put("CST", tz);
|
---|
167 | timezones.put("CST6CDT", tz);
|
---|
168 | timezones.put("America/Cambridge_Bay", tz);
|
---|
169 | timezones.put("America/Cancun", tz);
|
---|
170 | timezones.put("America/Chicago", tz);
|
---|
171 | timezones.put("America/Menominee", tz);
|
---|
172 | timezones.put("America/Merida", tz);
|
---|
173 | timezones.put("America/Mexico_City", tz);
|
---|
174 | timezones.put("America/Monterrey", tz);
|
---|
175 | timezones.put("America/Rainy_River", tz);
|
---|
176 | timezones.put("America/Winnipeg", tz);
|
---|
177 | tz = new SimpleTimeZone(-6000 * 3600, "America/Belize");
|
---|
178 | timezones.put("America/Belize", tz);
|
---|
179 | timezones.put("America/Costa_Rica", tz);
|
---|
180 | timezones.put("America/El_Salvador", tz);
|
---|
181 | timezones.put("America/Guatemala", tz);
|
---|
182 | timezones.put("America/Managua", tz);
|
---|
183 | timezones.put("America/Regina", tz);
|
---|
184 | timezones.put("America/Swift_Current", tz);
|
---|
185 | timezones.put("America/Tegucigalpa", tz);
|
---|
186 | timezones.put("Pacific/Galapagos", tz);
|
---|
187 | tz = new SimpleTimeZone
|
---|
188 | (-6000 * 3600, "Pacific/Easter",
|
---|
189 | Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
|
---|
190 | Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
|
---|
191 | timezones.put("Pacific/Easter", tz);
|
---|
192 | tz = new SimpleTimeZone
|
---|
193 | (-5000 * 3600, "America/Grand_Turk",
|
---|
194 | Calendar.APRIL, 1, Calendar.SUNDAY, 0 * 3600,
|
---|
195 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
196 | timezones.put("America/Grand_Turk", tz);
|
---|
197 | timezones.put("America/Havana", tz);
|
---|
198 | tz = new SimpleTimeZone(-5000 * 3600, "EST5");
|
---|
199 | timezones.put("EST5", tz);
|
---|
200 | timezones.put("IET", tz);
|
---|
201 | timezones.put("America/Bogota", tz);
|
---|
202 | timezones.put("America/Cayman", tz);
|
---|
203 | timezones.put("America/Eirunepe", tz);
|
---|
204 | timezones.put("America/Guayaquil", tz);
|
---|
205 | timezones.put("America/Indiana/Indianapolis", tz);
|
---|
206 | timezones.put("America/Indiana/Knox", tz);
|
---|
207 | timezones.put("America/Indiana/Marengo", tz);
|
---|
208 | timezones.put("America/Indiana/Vevay", tz);
|
---|
209 | timezones.put("America/Indianapolis", tz);
|
---|
210 | timezones.put("America/Iqaluit", tz);
|
---|
211 | timezones.put("America/Jamaica", tz);
|
---|
212 | timezones.put("America/Lima", tz);
|
---|
213 | timezones.put("America/Panama", tz);
|
---|
214 | timezones.put("America/Pangnirtung", tz);
|
---|
215 | timezones.put("America/Port-au-Prince", tz);
|
---|
216 | timezones.put("America/Porto_Acre", tz);
|
---|
217 | timezones.put("America/Rankin_Inlet", tz);
|
---|
218 | tz = new SimpleTimeZone
|
---|
219 | (-5000 * 3600, "EST",
|
---|
220 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
221 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
222 | timezones.put("EST", tz);
|
---|
223 | timezones.put("EST5EDT", tz);
|
---|
224 | timezones.put("America/Detroit", tz);
|
---|
225 | timezones.put("America/Kentucky/Louisville", tz);
|
---|
226 | timezones.put("America/Kentucky/Monticello", tz);
|
---|
227 | timezones.put("America/Louisville", tz);
|
---|
228 | timezones.put("America/Montreal", tz);
|
---|
229 | timezones.put("America/Nassau", tz);
|
---|
230 | timezones.put("America/New_York", tz);
|
---|
231 | timezones.put("America/Nipigon", tz);
|
---|
232 | timezones.put("America/Thunder_Bay", tz);
|
---|
233 | tz = new SimpleTimeZone(-4000 * 3600, "PRT");
|
---|
234 | timezones.put("PRT", tz);
|
---|
235 | timezones.put("America/Anguilla", tz);
|
---|
236 | timezones.put("America/Antigua", tz);
|
---|
237 | timezones.put("America/Aruba", tz);
|
---|
238 | timezones.put("America/Barbados", tz);
|
---|
239 | timezones.put("America/Boa_Vista", tz);
|
---|
240 | timezones.put("America/Caracas", tz);
|
---|
241 | timezones.put("America/Curacao", tz);
|
---|
242 | timezones.put("America/Dominica", tz);
|
---|
243 | timezones.put("America/Grenada", tz);
|
---|
244 | timezones.put("America/Guadeloupe", tz);
|
---|
245 | timezones.put("America/Guyana", tz);
|
---|
246 | timezones.put("America/La_Paz", tz);
|
---|
247 | timezones.put("America/Manaus", tz);
|
---|
248 | timezones.put("America/Martinique", tz);
|
---|
249 | timezones.put("America/Montserrat", tz);
|
---|
250 | timezones.put("America/Port_of_Spain", tz);
|
---|
251 | timezones.put("America/Porto_Velho", tz);
|
---|
252 | timezones.put("America/Puerto_Rico", tz);
|
---|
253 | timezones.put("America/Santo_Domingo", tz);
|
---|
254 | timezones.put("America/St_Kitts", tz);
|
---|
255 | timezones.put("America/St_Lucia", tz);
|
---|
256 | timezones.put("America/St_Thomas", tz);
|
---|
257 | timezones.put("America/St_Vincent", tz);
|
---|
258 | timezones.put("America/Tortola", tz);
|
---|
259 | tz = new SimpleTimeZone
|
---|
260 | (-4000 * 3600, "America/Asuncion",
|
---|
261 | Calendar.OCTOBER, 1, Calendar.SUNDAY, 0 * 3600,
|
---|
262 | Calendar.FEBRUARY, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
263 | timezones.put("America/Asuncion", tz);
|
---|
264 | tz = new SimpleTimeZone
|
---|
265 | (-4000 * 3600, "America/Cuiaba",
|
---|
266 | Calendar.OCTOBER, 2, Calendar.SUNDAY, 0 * 3600,
|
---|
267 | Calendar.FEBRUARY, 3, Calendar.SUNDAY, 0 * 3600);
|
---|
268 | timezones.put("America/Cuiaba", tz);
|
---|
269 | tz = new SimpleTimeZone
|
---|
270 | (-4000 * 3600, "America/Goose_Bay",
|
---|
271 | Calendar.APRIL, 1, Calendar.SUNDAY, 60000,
|
---|
272 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000);
|
---|
273 | timezones.put("America/Goose_Bay", tz);
|
---|
274 | tz = new SimpleTimeZone
|
---|
275 | (-4000 * 3600, "America/Glace_Bay",
|
---|
276 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
277 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
278 | timezones.put("America/Glace_Bay", tz);
|
---|
279 | timezones.put("America/Halifax", tz);
|
---|
280 | timezones.put("America/Thule", tz);
|
---|
281 | timezones.put("Atlantic/Bermuda", tz);
|
---|
282 | tz = new SimpleTimeZone
|
---|
283 | (-4000 * 3600, "America/Santiago",
|
---|
284 | Calendar.OCTOBER, 9, -Calendar.SUNDAY, 0 * 3600,
|
---|
285 | Calendar.MARCH, 9, -Calendar.SUNDAY, 0 * 3600);
|
---|
286 | timezones.put("America/Santiago", tz);
|
---|
287 | timezones.put("Antarctica/Palmer", tz);
|
---|
288 | tz = new SimpleTimeZone
|
---|
289 | (-4000 * 3600, "Atlantic/Stanley",
|
---|
290 | Calendar.SEPTEMBER, 2, Calendar.SUNDAY, 0 * 3600,
|
---|
291 | Calendar.APRIL, 16, -Calendar.SUNDAY, 0 * 3600);
|
---|
292 | timezones.put("Atlantic/Stanley", tz);
|
---|
293 | tz = new SimpleTimeZone
|
---|
294 | (-3500 * 3600, "CNT",
|
---|
295 | Calendar.APRIL, 1, Calendar.SUNDAY, 60000,
|
---|
296 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 60000);
|
---|
297 | timezones.put("CNT", tz);
|
---|
298 | timezones.put("America/St_Johns", tz);
|
---|
299 | tz = new SimpleTimeZone
|
---|
300 | (-3000 * 3600, "America/Araguaina",
|
---|
301 | Calendar.OCTOBER, 2, Calendar.SUNDAY, 0 * 3600,
|
---|
302 | Calendar.FEBRUARY, 3, Calendar.SUNDAY, 0 * 3600);
|
---|
303 | timezones.put("America/Araguaina", tz);
|
---|
304 | timezones.put("America/Sao_Paulo", tz);
|
---|
305 | tz = new SimpleTimeZone(-3000 * 3600, "AGT");
|
---|
306 | timezones.put("AGT", tz);
|
---|
307 | timezones.put("America/Belem", tz);
|
---|
308 | timezones.put("America/Buenos_Aires", tz);
|
---|
309 | timezones.put("America/Catamarca", tz);
|
---|
310 | timezones.put("America/Cayenne", tz);
|
---|
311 | timezones.put("America/Cordoba", tz);
|
---|
312 | timezones.put("America/Fortaleza", tz);
|
---|
313 | timezones.put("America/Jujuy", tz);
|
---|
314 | timezones.put("America/Maceio", tz);
|
---|
315 | timezones.put("America/Mendoza", tz);
|
---|
316 | timezones.put("America/Montevideo", tz);
|
---|
317 | timezones.put("America/Paramaribo", tz);
|
---|
318 | timezones.put("America/Recife", tz);
|
---|
319 | timezones.put("America/Rosario", tz);
|
---|
320 | tz = new SimpleTimeZone
|
---|
321 | (-3000 * 3600, "America/Godthab",
|
---|
322 | Calendar.MARCH, 30, -Calendar.SATURDAY, 22000 * 3600,
|
---|
323 | Calendar.OCTOBER, 30, -Calendar.SATURDAY, 22000 * 3600);
|
---|
324 | timezones.put("America/Godthab", tz);
|
---|
325 | tz = new SimpleTimeZone
|
---|
326 | (-3000 * 3600, "America/Miquelon",
|
---|
327 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
328 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
329 | timezones.put("America/Miquelon", tz);
|
---|
330 | tz = new SimpleTimeZone(-2000 * 3600, "America/Noronha");
|
---|
331 | timezones.put("America/Noronha", tz);
|
---|
332 | timezones.put("Atlantic/South_Georgia", tz);
|
---|
333 | tz = new SimpleTimeZone
|
---|
334 | (-1000 * 3600, "America/Scoresbysund",
|
---|
335 | Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
|
---|
336 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
337 | timezones.put("America/Scoresbysund", tz);
|
---|
338 | timezones.put("Atlantic/Azores", tz);
|
---|
339 | tz = new SimpleTimeZone(-1000 * 3600, "Atlantic/Cape_Verde");
|
---|
340 | timezones.put("Atlantic/Cape_Verde", tz);
|
---|
341 | timezones.put("Atlantic/Jan_Mayen", tz);
|
---|
342 | tz = new SimpleTimeZone(0 * 3600, "GMT");
|
---|
343 | timezones.put("GMT", tz);
|
---|
344 | timezones.put("UTC", tz);
|
---|
345 | timezones.put("Africa/Abidjan", tz);
|
---|
346 | timezones.put("Africa/Accra", tz);
|
---|
347 | timezones.put("Africa/Bamako", tz);
|
---|
348 | timezones.put("Africa/Banjul", tz);
|
---|
349 | timezones.put("Africa/Bissau", tz);
|
---|
350 | timezones.put("Africa/Casablanca", tz);
|
---|
351 | timezones.put("Africa/Conakry", tz);
|
---|
352 | timezones.put("Africa/Dakar", tz);
|
---|
353 | timezones.put("Africa/El_Aaiun", tz);
|
---|
354 | timezones.put("Africa/Freetown", tz);
|
---|
355 | timezones.put("Africa/Lome", tz);
|
---|
356 | timezones.put("Africa/Monrovia", tz);
|
---|
357 | timezones.put("Africa/Nouakchott", tz);
|
---|
358 | timezones.put("Africa/Ouagadougou", tz);
|
---|
359 | timezones.put("Africa/Sao_Tome", tz);
|
---|
360 | timezones.put("Africa/Timbuktu", tz);
|
---|
361 | timezones.put("Atlantic/Reykjavik", tz);
|
---|
362 | timezones.put("Atlantic/St_Helena", tz);
|
---|
363 | timezones.put("Europe/Belfast", tz);
|
---|
364 | timezones.put("Europe/Dublin", tz);
|
---|
365 | timezones.put("Europe/London", tz);
|
---|
366 | tz = new SimpleTimeZone
|
---|
367 | (0 * 3600, "WET",
|
---|
368 | Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
|
---|
369 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
|
---|
370 | timezones.put("WET", tz);
|
---|
371 | timezones.put("Atlantic/Canary", tz);
|
---|
372 | timezones.put("Atlantic/Faeroe", tz);
|
---|
373 | timezones.put("Atlantic/Madeira", tz);
|
---|
374 | timezones.put("Europe/Lisbon", tz);
|
---|
375 | tz = new SimpleTimeZone(1000 * 3600, "Africa/Algiers");
|
---|
376 | timezones.put("Africa/Algiers", tz);
|
---|
377 | timezones.put("Africa/Bangui", tz);
|
---|
378 | timezones.put("Africa/Brazzaville", tz);
|
---|
379 | timezones.put("Africa/Douala", tz);
|
---|
380 | timezones.put("Africa/Kinshasa", tz);
|
---|
381 | timezones.put("Africa/Lagos", tz);
|
---|
382 | timezones.put("Africa/Libreville", tz);
|
---|
383 | timezones.put("Africa/Luanda", tz);
|
---|
384 | timezones.put("Africa/Malabo", tz);
|
---|
385 | timezones.put("Africa/Ndjamena", tz);
|
---|
386 | timezones.put("Africa/Niamey", tz);
|
---|
387 | timezones.put("Africa/Porto-Novo", tz);
|
---|
388 | timezones.put("Africa/Tunis", tz);
|
---|
389 | tz = new SimpleTimeZone
|
---|
390 | (1000 * 3600, "Africa/Windhoek",
|
---|
391 | Calendar.SEPTEMBER, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
392 | Calendar.APRIL, 1, Calendar.SUNDAY, 2000 * 3600);
|
---|
393 | timezones.put("Africa/Windhoek", tz);
|
---|
394 | tz = new SimpleTimeZone
|
---|
395 | (1000 * 3600, "CET",
|
---|
396 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
397 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
398 | timezones.put("CET", tz);
|
---|
399 | timezones.put("ECT", tz);
|
---|
400 | timezones.put("MET", tz);
|
---|
401 | timezones.put("Africa/Ceuta", tz);
|
---|
402 | timezones.put("Arctic/Longyearbyen", tz);
|
---|
403 | timezones.put("Europe/Amsterdam", tz);
|
---|
404 | timezones.put("Europe/Andorra", tz);
|
---|
405 | timezones.put("Europe/Belgrade", tz);
|
---|
406 | timezones.put("Europe/Berlin", tz);
|
---|
407 | timezones.put("Europe/Bratislava", tz);
|
---|
408 | timezones.put("Europe/Brussels", tz);
|
---|
409 | timezones.put("Europe/Budapest", tz);
|
---|
410 | timezones.put("Europe/Copenhagen", tz);
|
---|
411 | timezones.put("Europe/Gibraltar", tz);
|
---|
412 | timezones.put("Europe/Ljubljana", tz);
|
---|
413 | timezones.put("Europe/Luxembourg", tz);
|
---|
414 | timezones.put("Europe/Madrid", tz);
|
---|
415 | timezones.put("Europe/Malta", tz);
|
---|
416 | timezones.put("Europe/Monaco", tz);
|
---|
417 | timezones.put("Europe/Oslo", tz);
|
---|
418 | timezones.put("Europe/Paris", tz);
|
---|
419 | timezones.put("Europe/Prague", tz);
|
---|
420 | timezones.put("Europe/Rome", tz);
|
---|
421 | timezones.put("Europe/San_Marino", tz);
|
---|
422 | timezones.put("Europe/Sarajevo", tz);
|
---|
423 | timezones.put("Europe/Skopje", tz);
|
---|
424 | timezones.put("Europe/Stockholm", tz);
|
---|
425 | timezones.put("Europe/Tirane", tz);
|
---|
426 | timezones.put("Europe/Vaduz", tz);
|
---|
427 | timezones.put("Europe/Vatican", tz);
|
---|
428 | timezones.put("Europe/Vienna", tz);
|
---|
429 | timezones.put("Europe/Warsaw", tz);
|
---|
430 | timezones.put("Europe/Zagreb", tz);
|
---|
431 | timezones.put("Europe/Zurich", tz);
|
---|
432 | tz = new SimpleTimeZone
|
---|
433 | (2000 * 3600, "ART",
|
---|
434 | Calendar.APRIL, -1, Calendar.FRIDAY, 0 * 3600,
|
---|
435 | Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 23000 * 3600);
|
---|
436 | timezones.put("ART", tz);
|
---|
437 | timezones.put("Africa/Cairo", tz);
|
---|
438 | tz = new SimpleTimeZone(2000 * 3600, "CAT");
|
---|
439 | timezones.put("CAT", tz);
|
---|
440 | timezones.put("Africa/Blantyre", tz);
|
---|
441 | timezones.put("Africa/Bujumbura", tz);
|
---|
442 | timezones.put("Africa/Gaborone", tz);
|
---|
443 | timezones.put("Africa/Harare", tz);
|
---|
444 | timezones.put("Africa/Johannesburg", tz);
|
---|
445 | timezones.put("Africa/Kigali", tz);
|
---|
446 | timezones.put("Africa/Lubumbashi", tz);
|
---|
447 | timezones.put("Africa/Lusaka", tz);
|
---|
448 | timezones.put("Africa/Maputo", tz);
|
---|
449 | timezones.put("Africa/Maseru", tz);
|
---|
450 | timezones.put("Africa/Mbabane", tz);
|
---|
451 | timezones.put("Africa/Tripoli", tz);
|
---|
452 | timezones.put("Europe/Riga", tz);
|
---|
453 | timezones.put("Europe/Tallinn", tz);
|
---|
454 | timezones.put("Europe/Vilnius", tz);
|
---|
455 | tz = new SimpleTimeZone
|
---|
456 | (2000 * 3600, "Asia/Amman",
|
---|
457 | Calendar.MARCH, -1, Calendar.THURSDAY, 0 * 3600,
|
---|
458 | Calendar.SEPTEMBER, -1, Calendar.THURSDAY, 0 * 3600);
|
---|
459 | timezones.put("Asia/Amman", tz);
|
---|
460 | tz = new SimpleTimeZone
|
---|
461 | (2000 * 3600, "Asia/Beirut",
|
---|
462 | Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
|
---|
463 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
464 | timezones.put("Asia/Beirut", tz);
|
---|
465 | tz = new SimpleTimeZone
|
---|
466 | (2000 * 3600, "Asia/Damascus",
|
---|
467 | Calendar.APRIL, 1, 0, 0 * 3600,
|
---|
468 | Calendar.OCTOBER, 1, 0, 0 * 3600);
|
---|
469 | timezones.put("Asia/Damascus", tz);
|
---|
470 | tz = new SimpleTimeZone
|
---|
471 | (2000 * 3600, "Asia/Gaza",
|
---|
472 | Calendar.APRIL, 3, Calendar.FRIDAY, 0 * 3600,
|
---|
473 | Calendar.OCTOBER, 3, Calendar.FRIDAY, 0 * 3600);
|
---|
474 | timezones.put("Asia/Gaza", tz);
|
---|
475 | tz = new SimpleTimeZone
|
---|
476 | (2000 * 3600, "Asia/Jerusalem",
|
---|
477 | Calendar.APRIL, 1, 0, 1000 * 3600,
|
---|
478 | Calendar.OCTOBER, 1, 0, 1000 * 3600);
|
---|
479 | timezones.put("Asia/Jerusalem", tz);
|
---|
480 | tz = new SimpleTimeZone
|
---|
481 | (2000 * 3600, "EET",
|
---|
482 | Calendar.MARCH, -1, Calendar.SUNDAY, 3000 * 3600,
|
---|
483 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 3000 * 3600);
|
---|
484 | timezones.put("EET", tz);
|
---|
485 | timezones.put("Asia/Istanbul", tz);
|
---|
486 | timezones.put("Asia/Nicosia", tz);
|
---|
487 | timezones.put("Europe/Athens", tz);
|
---|
488 | timezones.put("Europe/Bucharest", tz);
|
---|
489 | timezones.put("Europe/Chisinau", tz);
|
---|
490 | timezones.put("Europe/Helsinki", tz);
|
---|
491 | timezones.put("Europe/Istanbul", tz);
|
---|
492 | timezones.put("Europe/Kiev", tz);
|
---|
493 | timezones.put("Europe/Nicosia", tz);
|
---|
494 | timezones.put("Europe/Simferopol", tz);
|
---|
495 | timezones.put("Europe/Sofia", tz);
|
---|
496 | timezones.put("Europe/Uzhgorod", tz);
|
---|
497 | timezones.put("Europe/Zaporozhye", tz);
|
---|
498 | tz = new SimpleTimeZone
|
---|
499 | (2000 * 3600, "Europe/Kaliningrad",
|
---|
500 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
501 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
502 | timezones.put("Europe/Kaliningrad", tz);
|
---|
503 | timezones.put("Europe/Minsk", tz);
|
---|
504 | tz = new SimpleTimeZone
|
---|
505 | (3000 * 3600, "Asia/Baghdad",
|
---|
506 | Calendar.APRIL, 1, 0, 3000 * 3600,
|
---|
507 | Calendar.OCTOBER, 1, 0, 3000 * 3600);
|
---|
508 | timezones.put("Asia/Baghdad", tz);
|
---|
509 | tz = new SimpleTimeZone
|
---|
510 | (3000 * 3600, "Europe/Moscow",
|
---|
511 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
512 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
513 | timezones.put("Europe/Moscow", tz);
|
---|
514 | timezones.put("Europe/Tiraspol", tz);
|
---|
515 | tz = new SimpleTimeZone(3000 * 3600, "EAT");
|
---|
516 | timezones.put("EAT", tz);
|
---|
517 | timezones.put("Africa/Addis_Ababa", tz);
|
---|
518 | timezones.put("Africa/Asmera", tz);
|
---|
519 | timezones.put("Africa/Dar_es_Salaam", tz);
|
---|
520 | timezones.put("Africa/Djibouti", tz);
|
---|
521 | timezones.put("Africa/Kampala", tz);
|
---|
522 | timezones.put("Africa/Khartoum", tz);
|
---|
523 | timezones.put("Africa/Mogadishu", tz);
|
---|
524 | timezones.put("Africa/Nairobi", tz);
|
---|
525 | timezones.put("Antarctica/Syowa", tz);
|
---|
526 | timezones.put("Asia/Aden", tz);
|
---|
527 | timezones.put("Asia/Bahrain", tz);
|
---|
528 | timezones.put("Asia/Kuwait", tz);
|
---|
529 | timezones.put("Asia/Qatar", tz);
|
---|
530 | timezones.put("Asia/Riyadh", tz);
|
---|
531 | timezones.put("Indian/Antananarivo", tz);
|
---|
532 | timezones.put("Indian/Comoro", tz);
|
---|
533 | timezones.put("Indian/Mayotte", tz);
|
---|
534 | tz = new SimpleTimeZone(3500 * 3600, "Asia/Tehran");
|
---|
535 | timezones.put("Asia/Tehran", tz);
|
---|
536 | tz = new SimpleTimeZone
|
---|
537 | (4000 * 3600, "Asia/Baku",
|
---|
538 | Calendar.MARCH, -1, Calendar.SUNDAY, 1000 * 3600,
|
---|
539 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 1000 * 3600);
|
---|
540 | timezones.put("Asia/Baku", tz);
|
---|
541 | tz = new SimpleTimeZone
|
---|
542 | (4000 * 3600, "Asia/Aqtau",
|
---|
543 | Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
|
---|
544 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
545 | timezones.put("Asia/Aqtau", tz);
|
---|
546 | timezones.put("Asia/Tbilisi", tz);
|
---|
547 | tz = new SimpleTimeZone
|
---|
548 | (4000 * 3600, "Asia/Yerevan",
|
---|
549 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
550 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
551 | timezones.put("Asia/Yerevan", tz);
|
---|
552 | timezones.put("Europe/Samara", tz);
|
---|
553 | tz = new SimpleTimeZone(4000 * 3600, "NET");
|
---|
554 | timezones.put("NET", tz);
|
---|
555 | timezones.put("Asia/Dubai", tz);
|
---|
556 | timezones.put("Asia/Muscat", tz);
|
---|
557 | timezones.put("Indian/Mahe", tz);
|
---|
558 | timezones.put("Indian/Mauritius", tz);
|
---|
559 | timezones.put("Indian/Reunion", tz);
|
---|
560 | tz = new SimpleTimeZone(4500 * 3600, "Asia/Kabul");
|
---|
561 | timezones.put("Asia/Kabul", tz);
|
---|
562 | tz = new SimpleTimeZone
|
---|
563 | (5000 * 3600, "Asia/Aqtobe",
|
---|
564 | Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
|
---|
565 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
566 | timezones.put("Asia/Aqtobe", tz);
|
---|
567 | tz = new SimpleTimeZone
|
---|
568 | (5000 * 3600, "Asia/Bishkek",
|
---|
569 | Calendar.MARCH, -1, Calendar.SUNDAY, 2500 * 3600,
|
---|
570 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2500 * 3600);
|
---|
571 | timezones.put("Asia/Bishkek", tz);
|
---|
572 | tz = new SimpleTimeZone
|
---|
573 | (5000 * 3600, "Asia/Yekaterinburg",
|
---|
574 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
575 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
576 | timezones.put("Asia/Yekaterinburg", tz);
|
---|
577 | tz = new SimpleTimeZone(5000 * 3600, "PLT");
|
---|
578 | timezones.put("PLT", tz);
|
---|
579 | timezones.put("Asia/Ashgabat", tz);
|
---|
580 | timezones.put("Asia/Dushanbe", tz);
|
---|
581 | timezones.put("Asia/Karachi", tz);
|
---|
582 | timezones.put("Asia/Samarkand", tz);
|
---|
583 | timezones.put("Asia/Tashkent", tz);
|
---|
584 | timezones.put("Indian/Chagos", tz);
|
---|
585 | timezones.put("Indian/Kerguelen", tz);
|
---|
586 | timezones.put("Indian/Maldives", tz);
|
---|
587 | tz = new SimpleTimeZone(5500 * 3600, "IST");
|
---|
588 | timezones.put("IST", tz);
|
---|
589 | timezones.put("Asia/Calcutta", tz);
|
---|
590 | tz = new SimpleTimeZone(5750 * 3600, "Asia/Katmandu");
|
---|
591 | timezones.put("Asia/Katmandu", tz);
|
---|
592 | tz = new SimpleTimeZone(6000 * 3600, "BST");
|
---|
593 | timezones.put("BST", tz);
|
---|
594 | timezones.put("Antarctica/Mawson", tz);
|
---|
595 | timezones.put("Asia/Colombo", tz);
|
---|
596 | timezones.put("Asia/Dhaka", tz);
|
---|
597 | timezones.put("Asia/Thimphu", tz);
|
---|
598 | tz = new SimpleTimeZone
|
---|
599 | (6000 * 3600, "Asia/Almaty",
|
---|
600 | Calendar.MARCH, -1, Calendar.SUNDAY, 0 * 3600,
|
---|
601 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 0 * 3600);
|
---|
602 | timezones.put("Asia/Almaty", tz);
|
---|
603 | tz = new SimpleTimeZone
|
---|
604 | (6000 * 3600, "Asia/Novosibirsk",
|
---|
605 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
606 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
607 | timezones.put("Asia/Novosibirsk", tz);
|
---|
608 | timezones.put("Asia/Omsk", tz);
|
---|
609 | tz = new SimpleTimeZone(6500 * 3600, "Asia/Rangoon");
|
---|
610 | timezones.put("Asia/Rangoon", tz);
|
---|
611 | timezones.put("Indian/Cocos", tz);
|
---|
612 | tz = new SimpleTimeZone(7000 * 3600, "VST");
|
---|
613 | timezones.put("VST", tz);
|
---|
614 | timezones.put("Antarctica/Davis", tz);
|
---|
615 | timezones.put("Asia/Bangkok", tz);
|
---|
616 | timezones.put("Asia/Hovd", tz);
|
---|
617 | timezones.put("Asia/Jakarta", tz);
|
---|
618 | timezones.put("Asia/Phnom_Penh", tz);
|
---|
619 | timezones.put("Asia/Saigon", tz);
|
---|
620 | timezones.put("Asia/Vientiane", tz);
|
---|
621 | timezones.put("Indian/Christmas", tz);
|
---|
622 | tz = new SimpleTimeZone
|
---|
623 | (7000 * 3600, "Asia/Krasnoyarsk",
|
---|
624 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
625 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
626 | timezones.put("Asia/Krasnoyarsk", tz);
|
---|
627 | tz = new SimpleTimeZone(8000 * 3600, "CTT");
|
---|
628 | timezones.put("CTT", tz);
|
---|
629 | timezones.put("Antarctica/Casey", tz);
|
---|
630 | timezones.put("Asia/Brunei", tz);
|
---|
631 | timezones.put("Asia/Chungking", tz);
|
---|
632 | timezones.put("Asia/Harbin", tz);
|
---|
633 | timezones.put("Asia/Hong_Kong", tz);
|
---|
634 | timezones.put("Asia/Kashgar", tz);
|
---|
635 | timezones.put("Asia/Kuala_Lumpur", tz);
|
---|
636 | timezones.put("Asia/Kuching", tz);
|
---|
637 | timezones.put("Asia/Macao", tz);
|
---|
638 | timezones.put("Asia/Manila", tz);
|
---|
639 | timezones.put("Asia/Shanghai", tz);
|
---|
640 | timezones.put("Asia/Singapore", tz);
|
---|
641 | timezones.put("Asia/Taipei", tz);
|
---|
642 | timezones.put("Asia/Ujung_Pandang", tz);
|
---|
643 | timezones.put("Asia/Ulaanbaatar", tz);
|
---|
644 | timezones.put("Asia/Urumqi", tz);
|
---|
645 | timezones.put("Australia/Perth", tz);
|
---|
646 | tz = new SimpleTimeZone
|
---|
647 | (8000 * 3600, "Asia/Irkutsk",
|
---|
648 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
649 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
650 | timezones.put("Asia/Irkutsk", tz);
|
---|
651 | tz = new SimpleTimeZone(9000 * 3600, "JST");
|
---|
652 | timezones.put("JST", tz);
|
---|
653 | timezones.put("Asia/Dili", tz);
|
---|
654 | timezones.put("Asia/Jayapura", tz);
|
---|
655 | timezones.put("Asia/Pyongyang", tz);
|
---|
656 | timezones.put("Asia/Seoul", tz);
|
---|
657 | timezones.put("Asia/Tokyo", tz);
|
---|
658 | timezones.put("Pacific/Palau", tz);
|
---|
659 | tz = new SimpleTimeZone
|
---|
660 | (9000 * 3600, "Asia/Yakutsk",
|
---|
661 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
662 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
663 | timezones.put("Asia/Yakutsk", tz);
|
---|
664 | tz = new SimpleTimeZone
|
---|
665 | (9500 * 3600, "Australia/Adelaide",
|
---|
666 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
667 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
668 | timezones.put("Australia/Adelaide", tz);
|
---|
669 | timezones.put("Australia/Broken_Hill", tz);
|
---|
670 | tz = new SimpleTimeZone(9500 * 3600, "ACT");
|
---|
671 | timezones.put("ACT", tz);
|
---|
672 | timezones.put("Australia/Darwin", tz);
|
---|
673 | tz = new SimpleTimeZone(10000 * 3600, "Antarctica/DumontDUrville");
|
---|
674 | timezones.put("Antarctica/DumontDUrville", tz);
|
---|
675 | timezones.put("Australia/Brisbane", tz);
|
---|
676 | timezones.put("Australia/Lindeman", tz);
|
---|
677 | timezones.put("Pacific/Guam", tz);
|
---|
678 | timezones.put("Pacific/Port_Moresby", tz);
|
---|
679 | timezones.put("Pacific/Saipan", tz);
|
---|
680 | timezones.put("Pacific/Truk", tz);
|
---|
681 | timezones.put("Pacific/Yap", tz);
|
---|
682 | tz = new SimpleTimeZone
|
---|
683 | (10000 * 3600, "Asia/Vladivostok",
|
---|
684 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
685 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
686 | timezones.put("Asia/Vladivostok", tz);
|
---|
687 | tz = new SimpleTimeZone
|
---|
688 | (10000 * 3600, "Australia/Hobart",
|
---|
689 | Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
690 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
691 | timezones.put("Australia/Hobart", tz);
|
---|
692 | tz = new SimpleTimeZone
|
---|
693 | (10000 * 3600, "AET",
|
---|
694 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
695 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
696 | timezones.put("AET", tz);
|
---|
697 | timezones.put("Australia/Melbourne", tz);
|
---|
698 | timezones.put("Australia/Sydney", tz);
|
---|
699 | tz = new SimpleTimeZone
|
---|
700 | (10500 * 3600, "Australia/Lord_Howe",
|
---|
701 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
702 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600, 500 * 3600);
|
---|
703 | timezones.put("Australia/Lord_Howe", tz);
|
---|
704 | tz = new SimpleTimeZone
|
---|
705 | (11000 * 3600, "Asia/Magadan",
|
---|
706 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
707 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
708 | timezones.put("Asia/Magadan", tz);
|
---|
709 | tz = new SimpleTimeZone(11000 * 3600, "SST");
|
---|
710 | timezones.put("SST", tz);
|
---|
711 | timezones.put("Pacific/Efate", tz);
|
---|
712 | timezones.put("Pacific/Guadalcanal", tz);
|
---|
713 | timezones.put("Pacific/Kosrae", tz);
|
---|
714 | timezones.put("Pacific/Noumea", tz);
|
---|
715 | timezones.put("Pacific/Ponape", tz);
|
---|
716 | tz = new SimpleTimeZone(11500 * 3600, "Pacific/Norfolk");
|
---|
717 | timezones.put("Pacific/Norfolk", tz);
|
---|
718 | tz = new SimpleTimeZone
|
---|
719 | (12000 * 3600, "NST",
|
---|
720 | Calendar.OCTOBER, 1, Calendar.SUNDAY, 2000 * 3600,
|
---|
721 | Calendar.MARCH, 3, Calendar.SUNDAY, 2000 * 3600);
|
---|
722 | timezones.put("NST", tz);
|
---|
723 | timezones.put("Antarctica/McMurdo", tz);
|
---|
724 | timezones.put("Antarctica/South_Pole", tz);
|
---|
725 | timezones.put("Pacific/Auckland", tz);
|
---|
726 | tz = new SimpleTimeZone
|
---|
727 | (12000 * 3600, "Asia/Anadyr",
|
---|
728 | Calendar.MARCH, -1, Calendar.SUNDAY, 2000 * 3600,
|
---|
729 | Calendar.OCTOBER, -1, Calendar.SUNDAY, 2000 * 3600);
|
---|
730 | timezones.put("Asia/Anadyr", tz);
|
---|
731 | timezones.put("Asia/Kamchatka", tz);
|
---|
732 | tz = new SimpleTimeZone(12000 * 3600, "Pacific/Fiji");
|
---|
733 | timezones.put("Pacific/Fiji", tz);
|
---|
734 | timezones.put("Pacific/Funafuti", tz);
|
---|
735 | timezones.put("Pacific/Kwajalein", tz);
|
---|
736 | timezones.put("Pacific/Majuro", tz);
|
---|
737 | timezones.put("Pacific/Nauru", tz);
|
---|
738 | timezones.put("Pacific/Tarawa", tz);
|
---|
739 | timezones.put("Pacific/Wake", tz);
|
---|
740 | timezones.put("Pacific/Wallis", tz);
|
---|
741 | tz = new SimpleTimeZone
|
---|
742 | (12750 * 3600, "Pacific/Chatham",
|
---|
743 | Calendar.OCTOBER, 1, Calendar.SUNDAY, 2750 * 3600,
|
---|
744 | Calendar.MARCH, 3, Calendar.SUNDAY, 2750 * 3600);
|
---|
745 | timezones.put("Pacific/Chatham", tz);
|
---|
746 | tz = new SimpleTimeZone(13000 * 3600, "Pacific/Enderbury");
|
---|
747 | timezones.put("Pacific/Enderbury", tz);
|
---|
748 | timezones.put("Pacific/Tongatapu", tz);
|
---|
749 | tz = new SimpleTimeZone(14000 * 3600, "Pacific/Kiritimati");
|
---|
750 | timezones.put("Pacific/Kiritimati", tz);
|
---|
751 | }
|
---|
752 |
|
---|
753 |
|
---|
754 | /* Look up default timezone */
|
---|
755 | static
|
---|
756 | {
|
---|
757 | if (Configuration.INIT_LOAD_LIBRARY)
|
---|
758 | {
|
---|
759 | System.loadLibrary("javautil");
|
---|
760 | }
|
---|
761 | String tzid = System.getProperty("user.timezone");
|
---|
762 |
|
---|
763 | if (tzid == null)
|
---|
764 | tzid = getDefaultTimeZoneId();
|
---|
765 |
|
---|
766 | if (tzid == null)
|
---|
767 | tzid = "GMT";
|
---|
768 |
|
---|
769 | defaultZone = getTimeZone(tzid);
|
---|
770 | }
|
---|
771 |
|
---|
772 | /* This method returns us a time zone id string which is in the
|
---|
773 | form <standard zone name><GMT offset><daylight time zone name>.
|
---|
774 | The GMT offset is in seconds, except where it is evenly divisible
|
---|
775 | by 3600, then it is in hours. If the zone does not observe
|
---|
776 | daylight time, then the daylight zone name is omitted. Examples:
|
---|
777 | in Chicago, the timezone would be CST6CDT. In Indianapolis
|
---|
778 | (which does not have Daylight Savings Time) the string would
|
---|
779 | be EST5
|
---|
780 | */
|
---|
781 | private static native String getDefaultTimeZoneId();
|
---|
782 |
|
---|
783 | /**
|
---|
784 | * Gets the time zone offset, for current date, modified in case of
|
---|
785 | * daylight savings. This is the offset to add to UTC to get the local
|
---|
786 | * time.
|
---|
787 | * @param era the era of the given date
|
---|
788 | * @param year the year of the given date
|
---|
789 | * @param month the month of the given date, 0 for January.
|
---|
790 | * @param day the day of month
|
---|
791 | * @param dayOfWeek the day of week
|
---|
792 | * @param milliseconds the millis in the day (in local standard time)
|
---|
793 | * @return the time zone offset in milliseconds.
|
---|
794 | */
|
---|
795 | public abstract int getOffset(int era, int year, int month,
|
---|
796 | int day, int dayOfWeek, int milliseconds);
|
---|
797 |
|
---|
798 | /**
|
---|
799 | * Gets the time zone offset, ignoring daylight savings. This is
|
---|
800 | * the offset to add to UTC to get the local time.
|
---|
801 | * @return the time zone offset in milliseconds.
|
---|
802 | */
|
---|
803 | public abstract int getRawOffset();
|
---|
804 |
|
---|
805 | /**
|
---|
806 | * Sets the time zone offset, ignoring daylight savings. This is
|
---|
807 | * the offset to add to UTC to get the local time.
|
---|
808 | * @param offsetMillis the time zone offset to GMT.
|
---|
809 | */
|
---|
810 | public abstract void setRawOffset(int offsetMillis);
|
---|
811 |
|
---|
812 | /**
|
---|
813 | * Gets the identifier of this time zone. For instance, PST for
|
---|
814 | * Pacific Standard Time.
|
---|
815 | * @returns the ID of this time zone.
|
---|
816 | */
|
---|
817 | public String getID()
|
---|
818 | {
|
---|
819 | return ID;
|
---|
820 | }
|
---|
821 |
|
---|
822 | /**
|
---|
823 | * Sets the identifier of this time zone. For instance, PST for
|
---|
824 | * Pacific Standard Time.
|
---|
825 | * @param id the new time zone ID.
|
---|
826 | */
|
---|
827 | public void setID(String id)
|
---|
828 | {
|
---|
829 | this.ID = id;
|
---|
830 | }
|
---|
831 |
|
---|
832 | /**
|
---|
833 | * This method returns a string name of the time zone suitable
|
---|
834 | * for displaying to the user. The string returned will be the long
|
---|
835 | * description of the timezone in the current locale. The name
|
---|
836 | * displayed will assume daylight savings time is not in effect.
|
---|
837 | *
|
---|
838 | * @return The name of the time zone.
|
---|
839 | */
|
---|
840 | public final String getDisplayName()
|
---|
841 | {
|
---|
842 | return (getDisplayName(false, LONG, Locale.getDefault()));
|
---|
843 | }
|
---|
844 |
|
---|
845 | /**
|
---|
846 | * This method returns a string name of the time zone suitable
|
---|
847 | * for displaying to the user. The string returned will be the long
|
---|
848 | * description of the timezone in the specified locale. The name
|
---|
849 | * displayed will assume daylight savings time is not in effect.
|
---|
850 | *
|
---|
851 | * @param locale The locale for this timezone name.
|
---|
852 | *
|
---|
853 | * @return The name of the time zone.
|
---|
854 | */
|
---|
855 | public final String getDisplayName(Locale locale)
|
---|
856 | {
|
---|
857 | return (getDisplayName(false, LONG, locale));
|
---|
858 | }
|
---|
859 |
|
---|
860 | /**
|
---|
861 | * This method returns a string name of the time zone suitable
|
---|
862 | * for displaying to the user. The string returned will be of the
|
---|
863 | * specified type in the current locale.
|
---|
864 | *
|
---|
865 | * @param dst Whether or not daylight savings time is in effect.
|
---|
866 | * @param style <code>LONG</code> for a long name, <code>SHORT</code> for
|
---|
867 | * a short abbreviation.
|
---|
868 | *
|
---|
869 | * @return The name of the time zone.
|
---|
870 | */
|
---|
871 | public final String getDisplayName(boolean dst, int style)
|
---|
872 | {
|
---|
873 | return (getDisplayName(dst, style, Locale.getDefault()));
|
---|
874 | }
|
---|
875 |
|
---|
876 |
|
---|
877 | /**
|
---|
878 | * This method returns a string name of the time zone suitable
|
---|
879 | * for displaying to the user. The string returned will be of the
|
---|
880 | * specified type in the specified locale.
|
---|
881 | *
|
---|
882 | * @param dst Whether or not daylight savings time is in effect.
|
---|
883 | * @param style <code>LONG</code> for a long name, <code>SHORT</code> for
|
---|
884 | * a short abbreviation.
|
---|
885 | * @param locale The locale for this timezone name.
|
---|
886 | *
|
---|
887 | * @return The name of the time zone.
|
---|
888 | */
|
---|
889 | public String getDisplayName(boolean dst, int style, Locale locale)
|
---|
890 | {
|
---|
891 | DateFormatSymbols dfs;
|
---|
892 | try
|
---|
893 | {
|
---|
894 | dfs = new DateFormatSymbols(locale);
|
---|
895 |
|
---|
896 | // The format of the value returned is defined by us.
|
---|
897 | String[][]zoneinfo = dfs.getZoneStrings();
|
---|
898 | for (int i = 0; i < zoneinfo.length; i++)
|
---|
899 | {
|
---|
900 | if (zoneinfo[i][0].equals(getID()))
|
---|
901 | {
|
---|
902 | if (!dst)
|
---|
903 | {
|
---|
904 | if (style == SHORT)
|
---|
905 | return (zoneinfo[i][2]);
|
---|
906 | else
|
---|
907 | return (zoneinfo[i][1]);
|
---|
908 | }
|
---|
909 | else
|
---|
910 | {
|
---|
911 | if (style == SHORT)
|
---|
912 | return (zoneinfo[i][4]);
|
---|
913 | else
|
---|
914 | return (zoneinfo[i][3]);
|
---|
915 | }
|
---|
916 | }
|
---|
917 | }
|
---|
918 | }
|
---|
919 | catch (MissingResourceException e)
|
---|
920 | {
|
---|
921 | }
|
---|
922 |
|
---|
923 | return getDefaultDisplayName(dst);
|
---|
924 | }
|
---|
925 |
|
---|
926 | private String getDefaultDisplayName(boolean dst)
|
---|
927 | {
|
---|
928 | int offset = getRawOffset();
|
---|
929 | if (dst && this instanceof SimpleTimeZone)
|
---|
930 | {
|
---|
931 | // ugly, but this is a design failure of the API:
|
---|
932 | // getDisplayName takes a dst parameter even though
|
---|
933 | // TimeZone knows nothing about daylight saving offsets.
|
---|
934 | offset += ((SimpleTimeZone) this).getDSTSavings();
|
---|
935 | }
|
---|
936 |
|
---|
937 | StringBuffer sb = new StringBuffer(9);
|
---|
938 | sb.append("GMT");
|
---|
939 | sb.append(offset >= 0 ? '+' : '-');
|
---|
940 |
|
---|
941 | offset = Math.abs(offset) / (1000 * 60);
|
---|
942 | int hours = offset / 60;
|
---|
943 | int minutes = offset % 60;
|
---|
944 |
|
---|
945 | sb.append((char) ('0' + hours / 10)).append((char) ('0' + hours % 10));
|
---|
946 | sb.append(':');
|
---|
947 | sb.append((char) ('0' + minutes / 10)).append((char) ('0' + minutes % 10));
|
---|
948 | return sb.toString();
|
---|
949 | }
|
---|
950 |
|
---|
951 | /**
|
---|
952 | * Returns true, if this time zone uses Daylight Savings Time.
|
---|
953 | */
|
---|
954 | public abstract boolean useDaylightTime();
|
---|
955 |
|
---|
956 | /**
|
---|
957 | * Returns true, if the given date is in Daylight Savings Time in this
|
---|
958 | * time zone.
|
---|
959 | * @param date the given Date.
|
---|
960 | */
|
---|
961 | public abstract boolean inDaylightTime(Date date);
|
---|
962 |
|
---|
963 | /**
|
---|
964 | * Gets the daylight savings offset. This is a positive offset in
|
---|
965 | * milliseconds with respect to standard time. Typically this
|
---|
966 | * is one hour, but for some time zones this may be half an our.
|
---|
967 | * <p>The default implementation returns 3600000 milliseconds
|
---|
968 | * (one hour) if the time zone uses daylight savings time
|
---|
969 | * (as specified by {@link #useDaylightTime()}), otherwise
|
---|
970 | * it returns 0.
|
---|
971 | * @return the daylight savings offset in milliseconds.
|
---|
972 | * @since 1.4
|
---|
973 | */
|
---|
974 | public int getDSTSavings ()
|
---|
975 | {
|
---|
976 | return useDaylightTime () ? 3600000 : 0;
|
---|
977 | }
|
---|
978 |
|
---|
979 | /**
|
---|
980 | * Gets the TimeZone for the given ID.
|
---|
981 | * @param ID the time zone identifier.
|
---|
982 | * @return The time zone for the identifier or GMT, if no such time
|
---|
983 | * zone exists.
|
---|
984 | */
|
---|
985 | // FIXME: XXX: JCL indicates this and other methods are synchronized.
|
---|
986 | public static TimeZone getTimeZone(String ID)
|
---|
987 | {
|
---|
988 | // First check timezones hash
|
---|
989 | TimeZone tz = (TimeZone) timezones.get(ID);
|
---|
990 | if (tz != null)
|
---|
991 | {
|
---|
992 | if (tz.getID().equals(ID))
|
---|
993 | return tz;
|
---|
994 |
|
---|
995 | // We always return a timezone with the requested ID.
|
---|
996 | // This is the same behaviour as with JDK1.2.
|
---|
997 | tz = (TimeZone) tz.clone();
|
---|
998 | tz.setID(ID);
|
---|
999 | // We also save the alias, so that we return the same
|
---|
1000 | // object again if getTimeZone is called with the same
|
---|
1001 | // alias.
|
---|
1002 | timezones.put(ID, tz);
|
---|
1003 | return tz;
|
---|
1004 | }
|
---|
1005 |
|
---|
1006 | // See if the ID is really a GMT offset form.
|
---|
1007 | // Note that GMT is in the table so we know it is different.
|
---|
1008 | if (ID.startsWith("GMT"))
|
---|
1009 | {
|
---|
1010 | int pos = 3;
|
---|
1011 | int offset_direction = 1;
|
---|
1012 |
|
---|
1013 | if (ID.charAt(pos) == '-')
|
---|
1014 | {
|
---|
1015 | offset_direction = -1;
|
---|
1016 | pos++;
|
---|
1017 | }
|
---|
1018 | else if (ID.charAt(pos) == '+')
|
---|
1019 | {
|
---|
1020 | pos++;
|
---|
1021 | }
|
---|
1022 |
|
---|
1023 | try
|
---|
1024 | {
|
---|
1025 | int hour, minute;
|
---|
1026 |
|
---|
1027 | String offset_str = ID.substring(pos);
|
---|
1028 | int idx = offset_str.indexOf(":");
|
---|
1029 | if (idx != -1)
|
---|
1030 | {
|
---|
1031 | hour = Integer.parseInt(offset_str.substring(0, idx));
|
---|
1032 | minute = Integer.parseInt(offset_str.substring(idx + 1));
|
---|
1033 | }
|
---|
1034 | else
|
---|
1035 | {
|
---|
1036 | int offset_length = offset_str.length();
|
---|
1037 | if (offset_length <= 2)
|
---|
1038 | {
|
---|
1039 | // Only hour
|
---|
1040 | hour = Integer.parseInt(offset_str);
|
---|
1041 | minute = 0;
|
---|
1042 | }
|
---|
1043 | else
|
---|
1044 | {
|
---|
1045 | // hour and minute, not separated by colon
|
---|
1046 | hour = Integer.parseInt
|
---|
1047 | (offset_str.substring(0, offset_length - 2));
|
---|
1048 | minute = Integer.parseInt
|
---|
1049 | (offset_str.substring(offset_length - 2));
|
---|
1050 | }
|
---|
1051 | }
|
---|
1052 |
|
---|
1053 | return new SimpleTimeZone((hour * (60 * 60 * 1000) +
|
---|
1054 | minute * (60 * 1000))
|
---|
1055 | * offset_direction, ID);
|
---|
1056 | }
|
---|
1057 | catch (NumberFormatException e)
|
---|
1058 | {
|
---|
1059 | }
|
---|
1060 | }
|
---|
1061 |
|
---|
1062 | // Finally, return GMT per spec
|
---|
1063 | return getTimeZone("GMT");
|
---|
1064 | }
|
---|
1065 |
|
---|
1066 | /**
|
---|
1067 | * Gets the available IDs according to the given time zone
|
---|
1068 | * offset.
|
---|
1069 | * @param rawOffset the given time zone GMT offset.
|
---|
1070 | * @return An array of IDs, where the time zone has the specified GMT
|
---|
1071 | * offset. For example <code>{"Phoenix", "Denver"}</code>, since both have
|
---|
1072 | * GMT-07:00, but differ in daylight savings behaviour.
|
---|
1073 | */
|
---|
1074 | public static String[] getAvailableIDs(int rawOffset)
|
---|
1075 | {
|
---|
1076 | int count = 0;
|
---|
1077 | Iterator iter = timezones.entrySet().iterator();
|
---|
1078 | while (iter.hasNext())
|
---|
1079 | {
|
---|
1080 | // Don't iterate the values, since we want to count
|
---|
1081 | // doubled values (aliases)
|
---|
1082 | Map.Entry entry = (Map.Entry) iter.next();
|
---|
1083 | if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
|
---|
1084 | count++;
|
---|
1085 | }
|
---|
1086 |
|
---|
1087 | String[] ids = new String[count];
|
---|
1088 | count = 0;
|
---|
1089 | iter = timezones.entrySet().iterator();
|
---|
1090 | while (iter.hasNext())
|
---|
1091 | {
|
---|
1092 | Map.Entry entry = (Map.Entry) iter.next();
|
---|
1093 | if (((TimeZone) entry.getValue()).getRawOffset() == rawOffset)
|
---|
1094 | ids[count++] = (String) entry.getKey();
|
---|
1095 | }
|
---|
1096 | return ids;
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | /**
|
---|
1100 | * Gets all available IDs.
|
---|
1101 | * @return An array of all supported IDs.
|
---|
1102 | */
|
---|
1103 | public static String[] getAvailableIDs()
|
---|
1104 | {
|
---|
1105 | return (String[])
|
---|
1106 | timezones.keySet().toArray(new String[timezones.size()]);
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | /**
|
---|
1110 | * Returns the time zone under which the host is running. This
|
---|
1111 | * can be changed with setDefault.
|
---|
1112 | * @return the time zone for this host.
|
---|
1113 | * @see #setDefault
|
---|
1114 | */
|
---|
1115 | public static TimeZone getDefault()
|
---|
1116 | {
|
---|
1117 | return defaultZone;
|
---|
1118 | }
|
---|
1119 |
|
---|
1120 | public static void setDefault(TimeZone zone)
|
---|
1121 | {
|
---|
1122 | defaultZone = zone;
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 | /**
|
---|
1126 | * Test if the other time zone uses the same rule and only
|
---|
1127 | * possibly differs in ID. This implementation for this particular
|
---|
1128 | * class will return true if the raw offsets are identical. Subclasses
|
---|
1129 | * should override this method if they use daylight savings.
|
---|
1130 | * @return true if this zone has the same raw offset
|
---|
1131 | */
|
---|
1132 | public boolean hasSameRules(TimeZone other)
|
---|
1133 | {
|
---|
1134 | return other.getRawOffset() == getRawOffset();
|
---|
1135 | }
|
---|
1136 |
|
---|
1137 | /**
|
---|
1138 | * Returns a clone of this object. I can't imagine, why this is
|
---|
1139 | * useful for a time zone.
|
---|
1140 | */
|
---|
1141 | public Object clone()
|
---|
1142 | {
|
---|
1143 | try
|
---|
1144 | {
|
---|
1145 | return super.clone();
|
---|
1146 | }
|
---|
1147 | catch (CloneNotSupportedException ex)
|
---|
1148 | {
|
---|
1149 | return null;
|
---|
1150 | }
|
---|
1151 | }
|
---|
1152 | }
|
---|