Skip to content

Commit 6c0270d

Browse files
author
Sergey Nazarkin
committedOct 14, 2022
Merge
2 parents 0c416a0 + e2cbfd5 commit 6c0270d

File tree

9 files changed

+1221
-0
lines changed

9 files changed

+1221
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 8060126
27+
* @summary Make sure that the tzdata version matches between the run-time and tests.
28+
*/
29+
import java.time.zone.ZoneRules;
30+
import java.time.zone.ZoneRulesProvider;
31+
import java.util.NavigableMap;
32+
33+
public class AssureTzdataVersion {
34+
public static void main(String... args) throws Exception {
35+
// get the tzdata version for the run-time
36+
NavigableMap<String, ZoneRules> map;
37+
map = ZoneRulesProvider.getVersions("America/Los_Angeles");
38+
if (map.isEmpty()) {
39+
throw new RuntimeException("Unknown runtime tzdata version");
40+
}
41+
String runtime = map.lastEntry().getKey();
42+
43+
// get the tzdata version for regression tests
44+
String testdata = null;
45+
try (TextFileReader textreader = new TextFileReader("VERSION")) {
46+
testdata = textreader.getLine().substring("tzdata".length());
47+
}
48+
if (!testdata.equals(runtime)) {
49+
throw new RuntimeException("tzdata versions don't match: run-time=" + runtime
50+
+ ", tests=" + testdata);
51+
}
52+
}
53+
}
+246
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
/*
2+
* Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
/*
25+
* @test
26+
* @bug 6329116 6756569 6757131 6758988 6764308 6796489 6834474 6609737 6507067
27+
* 7039469 7090843 7103108 7103405 7158483 8008577 8059206 8064560 8072042
28+
* 8077685 8151876 8166875 8169191 8170316 8176044
29+
* @summary Make sure that timezone short display names are idenical to Olson's data.
30+
* @library /java/text/testlib
31+
* @build Bug6329116 TextFileReader
32+
* @run main/othervm -Djava.locale.providers=COMPAT,SPI Bug6329116
33+
*/
34+
35+
import java.io.*;
36+
import java.text.*;
37+
import java.util.*;
38+
39+
public class Bug6329116 extends IntlTest {
40+
41+
static Locale[] locales = Locale.getAvailableLocales();
42+
static String[] timezones = TimeZone.getAvailableIDs();
43+
44+
public static void main(String[] args) throws IOException {
45+
if (bug6329116()) {
46+
throw new RuntimeException("At least one timezone display name is incorrect.");
47+
}
48+
}
49+
50+
static boolean bug6329116() throws IOException {
51+
boolean err = false;
52+
53+
HashMap<String, String> aliasTable = new HashMap<>();
54+
HashSet<String> timezoneTable = new HashSet<>();
55+
for (String t : timezones) {
56+
timezoneTable.add(t);
57+
}
58+
59+
String line, key, value;
60+
StringTokenizer st;
61+
62+
try (TextFileReader in = new TextFileReader("aliases.txt")) {
63+
while ((line = in.readLine()) != null) {
64+
st = new StringTokenizer(line);
65+
st.nextToken();
66+
key = st.nextToken();
67+
value = st.nextToken();
68+
69+
if (!value.equals("ROC")) {
70+
if (aliasTable.containsKey(key)) {
71+
aliasTable.put(key, aliasTable.get(key) + " " + value);
72+
} else {
73+
aliasTable.put(key, value);
74+
}
75+
}
76+
}
77+
}
78+
79+
try (TextFileReader in = new TextFileReader("displaynames.txt")) {
80+
String timezoneID, expected, expected_DST, got;
81+
String[] aliases, tzs;
82+
TimeZone tz;
83+
while ((line = in.readLine()) != null) {
84+
st = new StringTokenizer(line);
85+
timezoneID = st.nextToken();
86+
expected = st.nextToken();
87+
if (st.hasMoreTokens()) {
88+
expected_DST = st.nextToken();
89+
} else {
90+
expected_DST = null;
91+
}
92+
93+
if (aliasTable.containsKey(timezoneID)) {
94+
aliases = aliasTable.get(timezoneID).split(" ");
95+
tzs = new String[1 + aliases.length];
96+
System.arraycopy(aliases, 0, tzs, 1, aliases.length);
97+
aliasTable.remove(timezoneID);
98+
} else {
99+
tzs = new String[1];
100+
}
101+
tzs[0] = timezoneID;
102+
103+
for (int j = 0; j < tzs.length; j++) {
104+
tz = TimeZone.getTimeZone(tzs[j]);
105+
106+
if (!tzs[j].equals(tz.getID())) {
107+
System.err.println(tzs[j] + " may not be a valid Timezone ID and \"" + tz.getID() + "\" was returned. Please check it.");
108+
err = true;
109+
}
110+
111+
timezoneTable.remove(tzs[j]);
112+
113+
for (int i = 0; i < locales.length; i++) {
114+
got = tz.getDisplayName(false, TimeZone.SHORT, locales[i]);
115+
if (!expected.equals(got) &&
116+
!expected.startsWith(got + "/") &&
117+
!expected.endsWith("/" + got)) {
118+
if (useLocalzedShortDisplayName(tz, locales[i], got, false)) {
119+
/*
120+
System.out.println(tzs[j] +
121+
((j > 0) ? "(Alias of \"" + tzs[0] + "\")" : "") +
122+
" seems to use a localized short display name" +
123+
": original: " + expected +
124+
": got: " + got + " for non-DST in " +
125+
locales[i] + " locale.");
126+
*/
127+
} else {
128+
System.err.println(tzs[j] +
129+
((j > 0) ? "(Alias of \"" + tzs[0] + "\")" : "") +
130+
": expected: " + expected +
131+
": got: " + got + " for non-DST in " +
132+
locales[i] + " locale.");
133+
err = true;
134+
}
135+
}
136+
137+
got = tz.getDisplayName(true, TimeZone.SHORT, locales[i]);
138+
if (expected_DST != null) {
139+
if (!expected_DST.equals(got) &&
140+
!expected_DST.startsWith(got + "/") &&
141+
!expected_DST.endsWith("/" + got)) {
142+
if (tzs[j].equals("Europe/London") &&
143+
locales[i].equals(new Locale("en", "IE"))) {
144+
continue;
145+
} else if (useLocalzedShortDisplayName(tz, locales[i], got, true)) {
146+
/*
147+
System.out.println(tzs[j] +
148+
((j > 0) ? "(Alias of \"" + tzs[0] + "\")" : "") +
149+
" seems to use a localized short display name" +
150+
": original: " + expected_DST +
151+
": got: " + got + " for DST in " +
152+
locales[i] + " locale.");
153+
*/
154+
continue;
155+
}
156+
System.err.println(tzs[j] +
157+
((j > 0) ? "(Alias of \"" + tzs[0] + "\")" : "") +
158+
": expected: " + expected_DST +
159+
": got: " + got + " for DST in " +
160+
locales[i] + " locale.");
161+
err = true;
162+
}
163+
} else {
164+
// Some timezones don't have DST display names in Olson's data,
165+
// and we created them ourselves based on non-DST display names
166+
// to prepare potential use in the future.
167+
// Because there's no expected name, we don't judge if these
168+
// DST display names are correct but just compare them with
169+
// non-DST diplay names for checking with our eyes .
170+
if (!expected.equals(got) &&
171+
!expected.startsWith(got + "/") &&
172+
!expected.endsWith("/" + got)) {
173+
/*
174+
System.out.println("## " + tzs[j] +
175+
((j > 0) ? "(Alias of \"" + tzs[0] + "\")" : "") +
176+
": expected: " + expected +
177+
": got: " + got + " for DST in " +
178+
locales[i] + " locale.");
179+
*/
180+
}
181+
}
182+
}
183+
}
184+
}
185+
}
186+
187+
if (!timezoneTable.isEmpty()) {
188+
System.out.println("# Timezone(s) valid in JRE but untested in this test program:");
189+
Iterator<String> it = timezoneTable.iterator();
190+
while (it.hasNext()) {
191+
System.out.println(it.next());
192+
}
193+
System.out.println();
194+
}
195+
196+
if (!aliasTable.isEmpty()) {
197+
System.out.println("# Timezone(s) exists in Olson's data as Link but unused in JRE:");
198+
for (Map.Entry<String, String> entry : aliasTable.entrySet()) {
199+
System.out.println(entry);
200+
}
201+
}
202+
203+
return err;
204+
}
205+
206+
static boolean useLocalzedShortDisplayName(TimeZone tz,
207+
Locale locale,
208+
String got,
209+
boolean inDST) {
210+
if (locale.getLanguage().equals("de")) {
211+
String name = tz.getDisplayName(inDST, TimeZone.LONG, locale);
212+
if (inDST) {
213+
if (("Mitteleurop\u00e4ische Sommerzeit".equals(name) && "MESZ".equals(got)) ||
214+
("Osteurop\u00e4ische Sommerzeit".equals(name) && "OESZ".equals(got)) ||
215+
("Westeurop\u00e4ische Sommerzeit".equals(name) && "WESZ".equals(got))) {
216+
return true;
217+
}
218+
} else {
219+
if (("Mitteleurop\u00e4ische Zeit".equals(name) && "MEZ".equals(got)) ||
220+
("Osteurop\u00e4ische Zeit".equals(name) && "OEZ".equals(got)) ||
221+
("Westeurop\u00e4ische Zeit".equals(name) && "WEZ".equals(got))) {
222+
return true;
223+
}
224+
}
225+
} else if (locale.getLanguage().equals("zh") &&
226+
(locale.getCountry().equals("TW") || locale.getCountry().equals("HK"))) {
227+
String name = tz.getDisplayName(inDST, TimeZone.LONG, locale);
228+
if (inDST) {
229+
if (("\u53f0\u7063\u590f\u4ee4\u6642\u9593".equals(name) && "TDT".equals(got))) {
230+
return true;
231+
}
232+
} else {
233+
if (("\u53f0\u7063\u6a19\u6e96\u6642\u9593".equals(name) && "TST".equals(got))) {
234+
return true;
235+
}
236+
}
237+
}
238+
// If we get a TimeZone with GMT+hh:mm format, we can ignore the offset value
239+
if (tz.getDisplayName(Locale.ENGLISH).startsWith("GMT+") || tz.getDisplayName(Locale.ENGLISH).startsWith("GMT-")) {
240+
return tz.getDisplayName().substring(0, 3).equals(got.substring(0, 3));
241+
}
242+
243+
return false;
244+
}
245+
246+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/*
2+
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
import java.io.*;
25+
26+
// This class is public so that tools can invoke.
27+
public class TextFileReader implements AutoCloseable {
28+
private BufferedReader reader;
29+
private int lineNo;
30+
31+
public TextFileReader(String filename) throws IOException {
32+
this(new File(new File(System.getProperty("test.src", "."),
33+
"TimeZoneData"),
34+
filename));
35+
}
36+
37+
public TextFileReader(File file) throws IOException {
38+
InputStream is = new FileInputStream(file);
39+
reader = new BufferedReader(new InputStreamReader(is, "utf-8"));
40+
}
41+
42+
public String readLine() throws IOException {
43+
return getLine();
44+
}
45+
46+
public String getLine() throws IOException {
47+
checkReader();
48+
49+
String line;
50+
while ((line = reader.readLine()) != null) {
51+
lineNo++;
52+
line = line.trim();
53+
// Skip blank and comment lines.
54+
if (line.length() == 0) {
55+
continue;
56+
}
57+
int x = line.indexOf('#');
58+
if (x == 0) {
59+
continue;
60+
}
61+
if (x > 0) {
62+
line = line.substring(0, x).trim();
63+
}
64+
break;
65+
}
66+
return line;
67+
}
68+
69+
public String getRawLine() throws IOException {
70+
checkReader();
71+
72+
String line = reader.readLine();
73+
if (line != null) {
74+
lineNo++;
75+
}
76+
return line;
77+
}
78+
79+
private void checkReader() throws IOException {
80+
if (reader == null) {
81+
throw new IOException("This TextFileReader has been closed.");
82+
}
83+
}
84+
85+
@Override
86+
public void close() throws IOException {
87+
reader.close();
88+
reader = null;
89+
}
90+
91+
int getLineNo() {
92+
return lineNo;
93+
}
94+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tzdata2022a
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
Link Africa/Abidjan Africa/Accra # Ghana
2+
Link Africa/Abidjan Africa/Bamako # Mali
3+
Link Africa/Abidjan Africa/Banjul # The Gambia
4+
Link Africa/Abidjan Africa/Conakry # Guinea
5+
Link Africa/Abidjan Africa/Dakar # Senegal
6+
Link Africa/Abidjan Africa/Freetown # Sierra Leone
7+
Link Africa/Abidjan Africa/Lome # Togo
8+
Link Africa/Abidjan Africa/Nouakchott # Mauritania
9+
Link Africa/Abidjan Africa/Ouagadougou # Burkina Faso
10+
Link Africa/Abidjan Atlantic/St_Helena # St Helena
11+
Link Africa/Nairobi Africa/Addis_Ababa # Ethiopia
12+
Link Africa/Nairobi Africa/Asmara # Eritrea
13+
Link Africa/Nairobi Africa/Dar_es_Salaam # Tanzania
14+
Link Africa/Nairobi Africa/Djibouti
15+
Link Africa/Nairobi Africa/Kampala # Uganda
16+
Link Africa/Nairobi Africa/Mogadishu # Somalia
17+
Link Africa/Nairobi Indian/Antananarivo # Madagascar
18+
Link Africa/Nairobi Indian/Comoro
19+
Link Africa/Nairobi Indian/Mayotte
20+
Link Africa/Maputo Africa/Blantyre # Malawi
21+
Link Africa/Maputo Africa/Bujumbura # Burundi
22+
Link Africa/Maputo Africa/Gaborone # Botswana
23+
Link Africa/Maputo Africa/Harare # Zimbabwe
24+
Link Africa/Maputo Africa/Kigali # Rwanda
25+
Link Africa/Maputo Africa/Lubumbashi # E Dem. Rep. of Congo
26+
Link Africa/Maputo Africa/Lusaka # Zambia
27+
Link Africa/Lagos Africa/Bangui # Central African Republic
28+
Link Africa/Lagos Africa/Brazzaville # Rep. of the Congo
29+
Link Africa/Lagos Africa/Douala # Cameroon
30+
Link Africa/Lagos Africa/Kinshasa # Dem. Rep. of the Congo (west)
31+
Link Africa/Lagos Africa/Libreville # Gabon
32+
Link Africa/Lagos Africa/Luanda # Angola
33+
Link Africa/Lagos Africa/Malabo # Equatorial Guinea
34+
Link Africa/Lagos Africa/Niamey # Niger
35+
Link Africa/Lagos Africa/Porto-Novo # Benin
36+
Link Africa/Johannesburg Africa/Maseru # Lesotho
37+
Link Africa/Johannesburg Africa/Mbabane # Eswatini
38+
Link Asia/Nicosia Europe/Nicosia
39+
Link Asia/Qatar Asia/Bahrain
40+
Link Asia/Riyadh Antarctica/Syowa
41+
Link Asia/Riyadh Asia/Aden # Yemen
42+
Link Asia/Riyadh Asia/Kuwait
43+
Link Asia/Bangkok Asia/Phnom_Penh # Cambodia
44+
Link Asia/Bangkok Asia/Vientiane # Laos
45+
Link Asia/Dubai Asia/Muscat # Oman
46+
Link Pacific/Guam Pacific/Saipan # N Mariana Is
47+
Link Pacific/Auckland Antarctica/McMurdo
48+
Link Pacific/Port_Moresby Antarctica/DumontDUrville
49+
Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
50+
Link Europe/London Europe/Jersey
51+
Link Europe/London Europe/Guernsey
52+
Link Europe/London Europe/Isle_of_Man
53+
Link Europe/Helsinki Europe/Mariehamn
54+
Link Europe/Zurich Europe/Busingen
55+
Link Europe/Rome Europe/Vatican
56+
Link Europe/Rome Europe/San_Marino
57+
Link Europe/Zurich Europe/Vaduz
58+
Link Europe/Oslo Arctic/Longyearbyen
59+
Link Europe/Belgrade Europe/Ljubljana # Slovenia
60+
Link Europe/Belgrade Europe/Podgorica # Montenegro
61+
Link Europe/Belgrade Europe/Sarajevo # Bosnia and Herzegovina
62+
Link Europe/Belgrade Europe/Skopje # North Macedonia
63+
Link Europe/Belgrade Europe/Zagreb # Croatia
64+
Link Europe/Prague Europe/Bratislava
65+
Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
66+
Link America/Phoenix America/Creston
67+
Link America/Toronto America/Nassau
68+
Link America/Panama America/Atikokan
69+
Link America/Panama America/Cayman
70+
Link America/Puerto_Rico America/Anguilla
71+
Link America/Puerto_Rico America/Antigua
72+
Link America/Puerto_Rico America/Aruba
73+
Link America/Puerto_Rico America/Curacao
74+
Link America/Puerto_Rico America/Blanc-Sablon # Quebec (Lower North Shore)
75+
Link America/Puerto_Rico America/Dominica
76+
Link America/Puerto_Rico America/Grenada
77+
Link America/Puerto_Rico America/Guadeloupe
78+
Link America/Puerto_Rico America/Kralendijk # Caribbean Netherlands
79+
Link America/Puerto_Rico America/Lower_Princes # Sint Maarten
80+
Link America/Puerto_Rico America/Marigot # St Martin (French part)
81+
Link America/Puerto_Rico America/Montserrat
82+
Link America/Puerto_Rico America/Port_of_Spain # Trinidad & Tobago
83+
Link America/Puerto_Rico America/St_Barthelemy # St Barthélemy
84+
Link America/Puerto_Rico America/St_Kitts # St Kitts & Nevis
85+
Link America/Puerto_Rico America/St_Lucia
86+
Link America/Puerto_Rico America/St_Thomas # Virgin Islands (US)
87+
Link America/Puerto_Rico America/St_Vincent
88+
Link America/Puerto_Rico America/Tortola # Virgin Islands (UK)
89+
Link Asia/Riyadh87 Mideast/Riyadh87
90+
Link Asia/Riyadh88 Mideast/Riyadh88
91+
Link Asia/Riyadh89 Mideast/Riyadh89
92+
Link Africa/Nairobi Africa/Asmera
93+
Link Africa/Abidjan Africa/Timbuktu
94+
Link America/Argentina/Catamarca America/Argentina/ComodRivadavia
95+
Link America/Adak America/Atka
96+
Link America/Argentina/Buenos_Aires America/Buenos_Aires
97+
Link America/Argentina/Catamarca America/Catamarca
98+
Link America/Panama America/Coral_Harbour
99+
Link America/Argentina/Cordoba America/Cordoba
100+
Link America/Tijuana America/Ensenada
101+
Link America/Indiana/Indianapolis America/Fort_Wayne
102+
Link America/Nuuk America/Godthab
103+
Link America/Indiana/Indianapolis America/Indianapolis
104+
Link America/Argentina/Jujuy America/Jujuy
105+
Link America/Indiana/Knox America/Knox_IN
106+
Link America/Kentucky/Louisville America/Louisville
107+
Link America/Argentina/Mendoza America/Mendoza
108+
Link America/Toronto America/Montreal
109+
Link America/Rio_Branco America/Porto_Acre
110+
Link America/Argentina/Cordoba America/Rosario
111+
Link America/Tijuana America/Santa_Isabel
112+
Link America/Denver America/Shiprock
113+
Link America/Puerto_Rico America/Virgin
114+
Link Pacific/Auckland Antarctica/South_Pole
115+
Link Asia/Ashgabat Asia/Ashkhabad
116+
Link Asia/Kolkata Asia/Calcutta
117+
Link Asia/Shanghai Asia/Chongqing
118+
Link Asia/Shanghai Asia/Chungking
119+
Link Asia/Dhaka Asia/Dacca
120+
Link Asia/Shanghai Asia/Harbin
121+
Link Asia/Urumqi Asia/Kashgar
122+
Link Asia/Kathmandu Asia/Katmandu
123+
Link Asia/Macau Asia/Macao
124+
Link Asia/Yangon Asia/Rangoon
125+
Link Asia/Ho_Chi_Minh Asia/Saigon
126+
Link Asia/Jerusalem Asia/Tel_Aviv
127+
Link Asia/Thimphu Asia/Thimbu
128+
Link Asia/Makassar Asia/Ujung_Pandang
129+
Link Asia/Ulaanbaatar Asia/Ulan_Bator
130+
Link Atlantic/Faroe Atlantic/Faeroe
131+
Link Europe/Oslo Atlantic/Jan_Mayen
132+
Link Australia/Sydney Australia/ACT
133+
Link Australia/Sydney Australia/Canberra
134+
Link Australia/Hobart Australia/Currie
135+
Link Australia/Lord_Howe Australia/LHI
136+
Link Australia/Sydney Australia/NSW
137+
Link Australia/Darwin Australia/North
138+
Link Australia/Brisbane Australia/Queensland
139+
Link Australia/Adelaide Australia/South
140+
Link Australia/Hobart Australia/Tasmania
141+
Link Australia/Melbourne Australia/Victoria
142+
Link Australia/Perth Australia/West
143+
Link Australia/Broken_Hill Australia/Yancowinna
144+
Link America/Rio_Branco Brazil/Acre
145+
Link America/Noronha Brazil/DeNoronha
146+
Link America/Sao_Paulo Brazil/East
147+
Link America/Manaus Brazil/West
148+
Link America/Halifax Canada/Atlantic
149+
Link America/Winnipeg Canada/Central
150+
Link America/Toronto Canada/Eastern
151+
Link America/Edmonton Canada/Mountain
152+
Link America/St_Johns Canada/Newfoundland
153+
Link America/Vancouver Canada/Pacific
154+
Link America/Regina Canada/Saskatchewan
155+
Link America/Whitehorse Canada/Yukon
156+
Link America/Santiago Chile/Continental
157+
Link Pacific/Easter Chile/EasterIsland
158+
Link America/Havana Cuba
159+
Link Africa/Cairo Egypt
160+
Link Europe/Dublin Eire
161+
Link Etc/UTC Etc/UCT
162+
Link Europe/London Europe/Belfast
163+
Link Europe/Chisinau Europe/Tiraspol
164+
Link Europe/London GB
165+
Link Europe/London GB-Eire
166+
Link Etc/GMT GMT+0
167+
Link Etc/GMT GMT-0
168+
Link Etc/GMT GMT0
169+
Link Etc/GMT Greenwich
170+
Link Asia/Hong_Kong Hongkong
171+
Link Atlantic/Reykjavik Iceland
172+
Link Asia/Tehran Iran
173+
Link Asia/Jerusalem Israel
174+
Link America/Jamaica Jamaica
175+
Link Asia/Tokyo Japan
176+
Link Pacific/Kwajalein Kwajalein
177+
Link Africa/Tripoli Libya
178+
Link America/Tijuana Mexico/BajaNorte
179+
Link America/Mazatlan Mexico/BajaSur
180+
Link America/Mexico_City Mexico/General
181+
Link Pacific/Auckland NZ
182+
Link Pacific/Chatham NZ-CHAT
183+
Link America/Denver Navajo
184+
Link Asia/Shanghai PRC
185+
Link Pacific/Kanton Pacific/Enderbury
186+
Link Pacific/Honolulu Pacific/Johnston
187+
Link Pacific/Pohnpei Pacific/Ponape
188+
Link Pacific/Pago_Pago Pacific/Samoa
189+
Link Pacific/Chuuk Pacific/Truk
190+
Link Pacific/Chuuk Pacific/Yap
191+
Link Europe/Warsaw Poland
192+
Link Europe/Lisbon Portugal
193+
Link Asia/Taipei ROC
194+
Link Asia/Seoul ROK
195+
Link Asia/Singapore Singapore
196+
Link Europe/Istanbul Turkey
197+
Link Etc/UTC UCT
198+
Link America/Anchorage US/Alaska
199+
Link America/Adak US/Aleutian
200+
Link America/Phoenix US/Arizona
201+
Link America/Chicago US/Central
202+
Link America/Indiana/Indianapolis US/East-Indiana
203+
Link America/New_York US/Eastern
204+
Link Pacific/Honolulu US/Hawaii
205+
Link America/Indiana/Knox US/Indiana-Starke
206+
Link America/Detroit US/Michigan
207+
Link America/Denver US/Mountain
208+
Link America/Los_Angeles US/Pacific
209+
Link Pacific/Pago_Pago US/Samoa
210+
Link Etc/UTC UTC
211+
Link Etc/UTC Universal
212+
Link Europe/Moscow W-SU
213+
Link Etc/UTC Zulu
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
Africa/Abidjan GMT
2+
Africa/Algiers CET
3+
Africa/Bissau GMT
4+
Africa/Cairo EET EEST
5+
Africa/Ceuta CET CEST
6+
Africa/Johannesburg SAST
7+
Africa/Juba CAT
8+
Africa/Khartoum CAT
9+
Africa/Lagos WAT
10+
Africa/Maputo CAT
11+
Africa/Monrovia GMT
12+
Africa/Nairobi EAT
13+
Africa/Ndjamena WAT
14+
Africa/Sao_Tome GMT
15+
Africa/Tripoli EET
16+
Africa/Tunis CET CEST
17+
Africa/Windhoek CAT WAT
18+
America/Adak HST HDT
19+
America/Anchorage AKST AKDT
20+
America/Bahia_Banderas CST CDT
21+
America/Barbados AST ADT
22+
America/Belize CST CDT
23+
America/Boise MST MDT
24+
America/Cambridge_Bay MST MDT
25+
America/Cancun EST
26+
America/Chicago CST CDT
27+
America/Chihuahua MST MDT
28+
America/Costa_Rica CST CDT
29+
America/Danmarkshavn GMT
30+
America/Dawson MST
31+
America/Dawson_Creek MST
32+
America/Denver MST MDT
33+
America/Detroit EST EDT
34+
America/Edmonton MST MDT
35+
America/El_Salvador CST CDT
36+
America/Fort_Nelson MST
37+
America/Glace_Bay AST ADT
38+
America/Goose_Bay AST ADT
39+
America/Grand_Turk EST EDT
40+
America/Guatemala CST CDT
41+
America/Halifax AST ADT
42+
America/Havana CST CDT
43+
America/Hermosillo MST
44+
America/Indiana/Indianapolis EST EDT
45+
America/Indiana/Knox CST CDT
46+
America/Indiana/Marengo EST EDT
47+
America/Indiana/Petersburg EST EDT
48+
America/Indiana/Tell_City CST CDT
49+
America/Indiana/Vevay EST EDT
50+
America/Indiana/Vincennes EST EDT
51+
America/Indiana/Winamac EST EDT
52+
America/Inuvik MST MDT
53+
America/Iqaluit EST EDT
54+
America/Jamaica EST
55+
America/Juneau AKST AKDT
56+
America/Kentucky/Louisville EST EDT
57+
America/Kentucky/Monticello EST EDT
58+
America/Los_Angeles PST PDT
59+
America/Managua CST CDT
60+
America/Martinique AST
61+
America/Matamoros CST CDT
62+
America/Mazatlan MST MDT
63+
America/Menominee CST CDT
64+
America/Merida CST CDT
65+
America/Metlakatla AKST AKDT
66+
America/Mexico_City CST CDT
67+
America/Moncton AST ADT
68+
America/Monterrey CST CDT
69+
America/New_York EST EDT
70+
America/Nipigon EST EDT
71+
America/Nome AKST AKDT
72+
America/North_Dakota/Beulah CST CDT
73+
America/North_Dakota/Center CST CDT
74+
America/North_Dakota/New_Salem CST CDT
75+
America/Ojinaga MST MDT
76+
America/Panama EST
77+
America/Pangnirtung EST EDT
78+
America/Phoenix MST
79+
America/Port-au-Prince EST EDT
80+
America/Puerto_Rico AST
81+
America/Rainy_River CST CDT
82+
America/Rankin_Inlet CST CDT
83+
America/Regina CST
84+
America/Resolute CST CDT
85+
America/Santo_Domingo AST
86+
America/Sitka AKST AKDT
87+
America/St_Johns NST NDT
88+
America/Swift_Current CST
89+
America/Tegucigalpa CST CDT
90+
America/Thule AST ADT
91+
America/Thunder_Bay EST EDT
92+
America/Tijuana PST PDT
93+
America/Toronto EST EDT
94+
America/Vancouver PST PDT
95+
America/Whitehorse MST
96+
America/Winnipeg CST CDT
97+
America/Yakutat AKST AKDT
98+
America/Yellowknife MST MDT
99+
Antarctica/Macquarie AEST AEDT
100+
Antarctica/Troll UTC
101+
Asia/Amman EET EEST
102+
Asia/Beirut EET EEST
103+
Asia/Damascus EET EEST
104+
Asia/Famagusta EET EEST
105+
Asia/Gaza EET EEST
106+
Asia/Hebron EET EEST
107+
Asia/Hong_Kong HKT HKST
108+
Asia/Jakarta WIB
109+
Asia/Jayapura WIT
110+
Asia/Jerusalem IST IDT
111+
Asia/Karachi PKT PKST
112+
Asia/Kolkata IST
113+
Asia/Macau CST CDT
114+
Asia/Makassar WITA
115+
Asia/Manila PST PDT
116+
Asia/Nicosia EET EEST
117+
Asia/Pontianak WIB
118+
Asia/Pyongyang KST
119+
Asia/Seoul KST KDT
120+
Asia/Shanghai CST CDT
121+
Asia/Taipei CST CDT
122+
Asia/Tokyo JST JDT
123+
Atlantic/Bermuda AST ADT
124+
Atlantic/Canary WET WEST
125+
Atlantic/Faroe WET WEST
126+
Atlantic/Madeira WET WEST
127+
Atlantic/Reykjavik GMT
128+
Australia/Adelaide ACST ACDT
129+
Australia/Brisbane AEST AEDT
130+
Australia/Broken_Hill ACST ACDT
131+
Australia/Darwin ACST ACDT
132+
Australia/Hobart AEST AEDT
133+
Australia/Lindeman AEST AEDT
134+
Australia/Melbourne AEST AEDT
135+
Australia/Perth AWST AWDT
136+
Australia/Sydney AEST AEDT
137+
CET CET CEST
138+
CST6CDT CST CDT
139+
EET EET EEST
140+
EST EST
141+
EST5EDT EST EDT
142+
Europe/Amsterdam CET CEST
143+
Europe/Andorra CET CEST
144+
Europe/Athens EET EEST
145+
Europe/Belgrade CET CEST
146+
Europe/Berlin CET CEST
147+
Europe/Brussels CET CEST
148+
Europe/Bucharest EET EEST
149+
Europe/Budapest CET CEST
150+
Europe/Chisinau EET EEST
151+
Europe/Copenhagen CET CEST
152+
Europe/Dublin IST/GMT IST/GMT
153+
Europe/Gibraltar CET CEST
154+
Europe/Helsinki EET EEST
155+
Europe/Kaliningrad EET
156+
Europe/Kiev EET EEST
157+
Europe/Lisbon WET WEST
158+
Europe/London GMT/BST GMT/BST
159+
Europe/Luxembourg CET CEST
160+
Europe/Madrid CET CEST
161+
Europe/Malta CET CEST
162+
Europe/Monaco CET CEST
163+
Europe/Moscow MSK
164+
Europe/Oslo CET CEST
165+
Europe/Paris CET CEST
166+
Europe/Prague CET CEST
167+
Europe/Riga EET EEST
168+
Europe/Rome CET CEST
169+
Europe/Simferopol MSK
170+
Europe/Sofia EET EEST
171+
Europe/Stockholm CET CEST
172+
Europe/Tallinn EET EEST
173+
Europe/Tirane CET CEST
174+
Europe/Uzhgorod EET EEST
175+
Europe/Vienna CET CEST
176+
Europe/Vilnius EET EEST
177+
Europe/Warsaw CET CEST
178+
Europe/Zaporozhye EET EEST
179+
Europe/Zurich CET CEST
180+
HST HST
181+
MET MET MEST
182+
MST MST
183+
MST7MDT MST MDT
184+
PST8PDT PST PDT
185+
Pacific/Auckland NZST NZDT
186+
Pacific/Guam ChST
187+
Pacific/Honolulu HST
188+
Pacific/Pago_Pago SST
189+
WET WET WEST
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#
2+
# Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation.
8+
#
9+
# This code is distributed in the hope that it will be useful, but WITHOUT
10+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
# version 2 for more details (a copy is included in the LICENSE file that
13+
# accompanied this code).
14+
#
15+
# You should have received a copy of the GNU General Public License version
16+
# 2 along with this work; if not, write to the Free Software Foundation,
17+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
#
19+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
# or visit www.oracle.com if you need additional information or have any
21+
# questions.
22+
#
23+
24+
#
25+
# Compares two year* test data files
26+
# Typical usage:
27+
# perl CompareYearData.pl ../../TimeZoneData/year2008 year2008
28+
#
29+
30+
%oldData = &readData($ARGV[0]);
31+
%newData = &readData($ARGV[1]);
32+
33+
foreach $key (sort(keys(%oldData))) {
34+
if (defined($newData{$key})) {
35+
if ($oldData{$key} ne $newData{$key}) {
36+
print "Changed:\n";
37+
print "$oldData{$key}";
38+
print "---\n";
39+
print "$newData{$key}";
40+
}
41+
delete $newData{$key};
42+
} else {
43+
print "Deleted:\n";
44+
print "$oldData{$key}";
45+
}
46+
}
47+
foreach $key (sort(keys(%newData))) {
48+
print "Added:\n";
49+
print "$newData{$key}";
50+
}
51+
52+
sub readData {
53+
local($file) = @_;
54+
55+
open(F, $file) || die "Can't open $file\n";
56+
my %data = ();
57+
my $line = 0;
58+
my $id = "";
59+
60+
while (<F>) {
61+
$line++;
62+
s/^\s*\d+ //;
63+
if (/tzdata\d+/) {
64+
$data{" version"} = $_;
65+
next;
66+
}
67+
if (/(\s*#.*$)/) {
68+
$data{" comments"} .= $_;
69+
next;
70+
}
71+
if (/^(Zone|Rule)/) {
72+
die "No id at line: $line\n" if ($id eq "");
73+
$data{$id} .= $_;
74+
} elsif (/^(\S+)\s+\S+/) {
75+
$id = $1;
76+
$data{$id} = $_;
77+
$flag = 1;
78+
} else {
79+
die "Unknown format at line: $line: $file\n";
80+
}
81+
}
82+
close(F);
83+
return %data;
84+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation.
8+
#
9+
# This code is distributed in the hope that it will be useful, but WITHOUT
10+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
# version 2 for more details (a copy is included in the LICENSE file that
13+
# accompanied this code).
14+
#
15+
# You should have received a copy of the GNU General Public License version
16+
# 2 along with this work; if not, write to the Free Software Foundation,
17+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
#
19+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
# or visit www.oracle.com if you need additional information or have any
21+
# questions.
22+
#
23+
24+
#
25+
#
26+
# This makefile is used to update the time zone tests data: aliases.txt displaynames.txt
27+
# and VERSION. After switching to new build system in JDK8 the following make
28+
# command should be used for test data updates:
29+
# make JDK_HOME=<path to built JDK with latest tzdata>
30+
# make install
31+
#
32+
33+
TZDATA = ../../../../../../../src/java.base/share/data/tzdata
34+
TZDATA_VER = `grep '^tzdata' $(TZDATA)/VERSION`
35+
TZNAME = africa antarctica asia australasia europe northamerica \
36+
solar87 solar88 solar89 southamerica \
37+
backward
38+
TZFILES = $(addprefix $(TZDATA)/, $(TZNAME))
39+
ALIASLIST = aliases.txt
40+
DISPLAYNAMES = displaynames.txt
41+
42+
all: $(DISPLAYNAMES) VERSION $(ALIASLIST)
43+
44+
$(DISPLAYNAMES): $(TZFILES) makeZoneData.pl
45+
(cat $(TZFILES) | perl makeZoneData.pl -v -V "$(TZDATA_VER)") 2>errors
46+
47+
VERSION: $(TZDATA)/VERSION
48+
echo "$(TZDATA_VER)" > VERSION
49+
50+
$(ALIASLIST): $(TZFILES)
51+
rm -f $(ALIASLIST)
52+
grep -h "^Link" $(TZFILES) >> $(ALIASLIST)
53+
54+
clean:
55+
rm -f $(DISPLAYNAMES) errors year???? VERSION $(ALIASLIST)
56+
57+
install:
58+
cp $(ALIASLIST) $(DISPLAYNAMES) VERSION ../../TimeZoneData/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
#
2+
# Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
3+
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
#
5+
# This code is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU General Public License version 2 only, as
7+
# published by the Free Software Foundation.
8+
#
9+
# This code is distributed in the hope that it will be useful, but WITHOUT
10+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
# version 2 for more details (a copy is included in the LICENSE file that
13+
# accompanied this code).
14+
#
15+
# You should have received a copy of the GNU General Public License version
16+
# 2 along with this work; if not, write to the Free Software Foundation,
17+
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
#
19+
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
# or visit www.oracle.com if you need additional information or have any
21+
# questions.
22+
#
23+
24+
#
25+
#
26+
#
27+
# Perl script to generate ZoneData from Olson public time zone data.
28+
#
29+
# For J2SE before JDK1.3, see ../../README how to update TimeZone.java
30+
# static TimeZoneData.
31+
# For J2SE since JDK1.4, this script is used to generate testdata(reference)
32+
# for ZoneData.sh which is one of TimeZone Regression test.
33+
34+
$continue = 0;
35+
36+
# verbose flag
37+
$verbose = 0;
38+
39+
# version of Olson's public zone information (e.g. "tzdata2000g")
40+
$versionName = "unknown";
41+
42+
# Number of testdata files.
43+
$count = 5;
44+
45+
# Display name datafile
46+
$displayNameFile = "displaynames.txt";
47+
48+
# time zone IDs to be generated. If it's empty, then generate all time
49+
# zone in the tzdata files.
50+
@javatzids = ();
51+
52+
#
53+
# Parses command-line options
54+
#
55+
while ($#ARGV >= 0) {
56+
if ($ARGV[0] =~ /^-v/) {
57+
$verbose = 1;
58+
} elsif ($ARGV[0] =~ /^-V/) {
59+
$versionName = $ARGV[1];
60+
shift(@ARGV);
61+
} else {
62+
@javatzids = &readIDs($ARGV[0]);
63+
last;
64+
}
65+
shift(@ARGV);
66+
}
67+
68+
# Beginning year of testdata
69+
($sec, $min, $hour, $mday, $mon, $year, $wday, $ydat, $isdst) = gmtime();
70+
$baseYear = $year+1900;
71+
72+
if ($verbose == 1) {
73+
print STDERR "baseYear : $baseYear\n";
74+
print STDERR "versionName : $versionName\n";
75+
}
76+
77+
# Open display name datafile
78+
open (DNFD, ">$displayNameFile") || die ("$displayNameFile : open error.\n");
79+
80+
while(<STDIN>) {
81+
chop;
82+
if (/^\#/) { # skip comment line
83+
next;
84+
}
85+
@item = ("foo");
86+
87+
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
88+
if ($continue == 1) {
89+
s/\#.*//; # chop trailing comments
90+
s/\s+$//;
91+
s/^\s+//;
92+
@item = split(/\s+/, $_);
93+
@item = ($zname, @item); # push zone name
94+
} elsif (/^Zone/) {
95+
s/\#.*//; # chop trailing comments
96+
s/\s+$//;
97+
@item = split(/\s+/, $_);
98+
$zname = $item[1];
99+
if (defined ($zones{$name})) {
100+
printf STDERR "WARNING: duplicate definition of zone $name\n";
101+
}
102+
shift(@item);
103+
}
104+
if (@item[0] ne "foo") {
105+
if($#item == 3) { # find out no UNTIL line
106+
$item[3] =~ s/%/%%/;
107+
$zones{$item[0]} = "Zone $item[0]\t$item[1]\t$item[2]\t$item[3]";
108+
} else {
109+
$continue = 1;
110+
next;
111+
}
112+
}
113+
114+
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
115+
if (/^Rule/) {
116+
($rule, $name, $from, $to, $type, $in, $on, $at, $save, $letter)
117+
= split(/\s+/, $_);
118+
119+
# matches specified year?
120+
for ($i = 0; $i < $count; $i++) {
121+
if ($from <= $baseYear+$i && ($to >= $baseYear+$i || $to eq "max")
122+
|| ($from == $baseYear+$i && $to eq "only")) {
123+
if ($save ne "0") {
124+
$rules[$i]{$name . "0"} = $_;
125+
} else {
126+
$rules[$i]{$name . "1"} = $_;
127+
}
128+
} else {
129+
if ($from <= $baseYear) {
130+
if ($save ne "0") {
131+
$oldRules[0]{$name} = $_;
132+
} else {
133+
$oldRules[1]{$name} = $_;
134+
}
135+
}
136+
}
137+
}
138+
}
139+
$continue = 0;
140+
}
141+
142+
#
143+
# Prepare output files
144+
#
145+
for ($i = 0, $fd = 0; $i < $count; $i++, $fd++) {
146+
$filename = "year".($baseYear+$i);
147+
open ($fd, ">$filename") || die ("$filename : open error.\n");
148+
print $fd "# Based on $versionName\n";
149+
}
150+
151+
#
152+
# If no IDs are specified, produce test data for all zones.
153+
#
154+
if ($#javatzids < 0) {
155+
@javatzids = keys(%zones);
156+
}
157+
158+
foreach $z (@javatzids) {
159+
#
160+
# skip any Riyadh zones; ZoneData.java can't handle Riyada zones
161+
#
162+
next if ($z =~ /Riyadh/);
163+
164+
for ($i = 0, $fd = 0; $i < $count; $i++, $fd++) {
165+
if (!defined($zones{$z})) {
166+
printf $fd "$z ?\n";
167+
printf STDERR "WARNING: java zone $z not found\n";
168+
next;
169+
}
170+
@item = split(/\s+/, $zones{$z});
171+
if ($item[3] ne "-") {
172+
printf $fd "$item[1] $item[2] ";
173+
if (defined($rules[$i]{$item[3] . "0"})
174+
&& defined($rules[$i]{$item[3] . "1"})) {
175+
$rule0 = $rules[$i]{$item[3] . "0"};
176+
$rule1 = $rules[$i]{$item[3] . "1"};
177+
@r0 = split(/\s+/, $rule0);
178+
@r1 = split(/\s+/, $rule1);
179+
printf $fd "$r0[5] $r0[6] $r0[7] $r1[5] $r1[6] $r1[7] $r0[8]\n";
180+
printf $fd "$zones{$z}\n";
181+
printf $fd "$rule0\n";
182+
printf $fd "$rule1\n";
183+
if ($i == 0) {
184+
$std = $dst = $item[4];
185+
$std =~ s/%%s/$r1[9]/;
186+
if ($r1[9] eq "-") {
187+
$std =~ s/-//;
188+
}
189+
$dst =~ s/%%s/$r0[9]/;
190+
if ($r0[9] eq "-") {
191+
$dst =~ s/-//;
192+
}
193+
if ("$std$dst" =~ /[A-Z]/) {
194+
print DNFD "$item[1] $std $dst\n";
195+
}
196+
}
197+
} else {
198+
printf $fd "-\n"; # In case we cannot find Rule, assume no DST.
199+
printf $fd "$zones{$z}\n";
200+
printf STDERR "WARNING: $z no rules defined for $item[3]\n";
201+
if ($i == 0) {
202+
# About 30 time zones (e.g. Asia/Tokyo needs the following
203+
# recovery.
204+
if ($item[4] =~ m/%/) {
205+
@r0 = split(/\s+/, $oldRules[0]{$item[3]});
206+
@r1 = split(/\s+/, $oldRules[1]{$item[3]});
207+
if ($i == 0) {
208+
$std = $dst = $item[4];
209+
$std =~ s/%%s/$r1[9]/;
210+
if ($r1[9] eq "-") {
211+
$std =~ s/-//;
212+
}
213+
$dst =~ s/%%s/$r0[9]/;
214+
if ($r0[9] eq "-") {
215+
$dst =~ s/-//;
216+
}
217+
if ("$std$dst" =~ /[A-Z]/) {
218+
print DNFD "$item[1] $std $dst\n";
219+
}
220+
}
221+
} else {
222+
if ("$item[4]" =~ /[A-Z]/) {
223+
print DNFD "$item[1] $item[4]\n";
224+
}
225+
}
226+
}
227+
}
228+
} else {
229+
printf $fd "$item[1] $item[2] $item[3]\n";
230+
printf $fd "$zones{$z}\n";
231+
if ($i == 0 && "$item[4]" =~ /[A-Z]/) {
232+
print DNFD "$item[1] $item[4]\n";
233+
}
234+
}
235+
}
236+
}
237+
238+
#
239+
# Close all the output files
240+
#
241+
close (DNFD);
242+
for ($i = 0, $fd = 0; $i < $count; $i++, $fd++) {
243+
close ($fd);
244+
}
245+
246+
#
247+
# Sort the displaynames.txt file
248+
#
249+
open my $fh, '<', $displayNameFile || die ("Can't open $displayNameFile for sorting\n");;
250+
chomp(my @names = <$fh>);
251+
close $fh;
252+
open my $fh, '>', $displayNameFile;
253+
foreach $line (sort @names) { print $fh $line,"\n"; }
254+
close $fh;
255+
256+
exit(0);
257+
258+
sub readIDs {
259+
local ($file) = @_;
260+
local (@ids, $i);
261+
262+
open(F, $file) || die "Fatal: can't open $file.\n";
263+
264+
$i = 0;
265+
while (<F>) {
266+
chop;
267+
if (/^\#/) { # skip comment line
268+
next;
269+
}
270+
271+
# trim any leading and trailing space
272+
s/^\s+//;
273+
s/\s+$//;
274+
275+
if (/^\s*$/) { # skip blank line
276+
next;
277+
}
278+
279+
$ids[$i++] = $_;
280+
}
281+
close(F);
282+
return @ids;
283+
}

0 commit comments

Comments
 (0)
Please sign in to comment.