From 9b8d68cc6589814d121344f59e927a7e4506fb8c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 2 Oct 2021 16:05:42 -0400 Subject: [PATCH] Update our mapping of Windows time zone names using CLDR info. This corrects a bunch of entries in win32_tzmap[], and adds a few new ones, based on the CLDR project's windowsZones.xml file. Non-cosmetic changes fall into four main categories: * Flat-out errors: US/Aleutan doesn't exist America/Salvador doesn't exist Asia/Baku is wrong for Yerevan Asia/Dhaka (Bangladesh) is wrong for Astana (Kazakhstan) Europe/Bucharest is wrong for Chisinau America/Mexico_City is wrong for Chetumal America/Buenos_Aires is wrong for Cayenne America/Caracas has its own zone, so poor fit for La Paz US/Eastern is wrong for Haiti US/Eastern is wrong for Indiana (East) Asia/Karachi is wrong for Tashkent Etc/UTC+12 doesn't exist Signs of Etc/GMT zones were backwards * Judgment calls: (These changes follow CLDR's choices, except for the first one) Use Europe/London for "Greenwich Standard Time", since that seems much more likely than Africa/Casablanca to be what people will think that zone name means. CLDR has Atlantic/Reykjavik here, but that's no better. Asia/Shanghai seems a better fit than Hong Kong for "China Standard Time". Europe/Sarajevo is now a link to Belgrade, ie "Central Europe Standard Time"; so use Warsaw for "Central European Standard Time". America/Sao_Paulo seems more representative than Araguaina for "E. South America Standard Time". Africa/Johannesburg seems more representative than Harare for "South Africa Standard Time". * New Windows zone names: "Israel Standard Time" "Kaliningrad Standard Time" "Russia Time Zone N" for various N "Singapore Standard Time" "South Sudan Standard Time" "W. Central Africa Standard Time" "West Bank Standard Time" "Yukon Standard Time" Some of these replace older spellings, but I kept the older spellings too in case our code runs on a machine with the older data. * Replace aliases (tzdb Links) with underlying city-named zones: (This tracks tzdb's longstanding practice, and reduces inconsistency with the rest of the entries, as well as with CLDR.) US/Alaska Asia/Kuwait Asia/Muscat Canada/Atlantic Australia/Canberra Canada/Saskatchewan US/Central US/Eastern US/Hawaii US/Mountain Canada/Newfoundland US/Pacific Back-patch to all supported branches, as is our usual practice for time zone data updates. Discussion: https://postgr.es/m/3266414.1633045628@sss.pgh.pa.us --- src/bin/initdb/findtimezone.c | 157 +++++++++++++++++++++++----------- 1 file changed, 106 insertions(+), 51 deletions(-) diff --git a/src/bin/initdb/findtimezone.c b/src/bin/initdb/findtimezone.c index 82cd7eebdb..c3b08aebf1 100644 --- a/src/bin/initdb/findtimezone.c +++ b/src/bin/initdb/findtimezone.c @@ -737,10 +737,12 @@ static const struct /* * This list was built from the contents of the registry at * HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time - * Zones on Windows 7, Windows 10, and Windows Server 2019. + * Zones on Windows 7, Windows 10, and Windows Server 2019. Some recent + * additions have been made by comparing to the CLDR project's + * windowsZones.xml file. * - * The zones have been matched to IANA timezones by looking at the cities - * listed in the win32 display name (in the comment here) in most cases. + * The zones have been matched to IANA timezones based on CLDR's mapping, + * with a few manual exceptions. */ { /* (UTC+04:30) Kabul */ @@ -750,12 +752,12 @@ static const struct { /* (UTC-09:00) Alaska */ "Alaskan Standard Time", "Alaskan Daylight Time", - "US/Alaska" + "America/Anchorage" }, { /* (UTC-10:00) Aleutian Islands */ "Aleutian Standard Time", "Aleutian Daylight Time", - "US/Aleutan" + "America/Adak" }, { /* (UTC+07:00) Barnaul, Gorno-Altaysk */ @@ -765,12 +767,12 @@ static const struct { /* (UTC+03:00) Kuwait, Riyadh */ "Arab Standard Time", "Arab Daylight Time", - "Asia/Kuwait" + "Asia/Riyadh" }, { /* (UTC+04:00) Abu Dhabi, Muscat */ "Arabian Standard Time", "Arabian Daylight Time", - "Asia/Muscat" + "Asia/Dubai" }, { /* (UTC+03:00) Baghdad */ @@ -795,7 +797,7 @@ static const struct { /* (UTC-04:00) Atlantic Time (Canada) */ "Atlantic Standard Time", "Atlantic Daylight Time", - "Canada/Atlantic" + "America/Halifax" }, { /* (UTC+09:30) Darwin */ @@ -810,7 +812,7 @@ static const struct { /* (UTC+10:00) Canberra, Melbourne, Sydney */ "AUS Eastern Standard Time", "AUS Eastern Daylight Time", - "Australia/Canberra" + "Australia/Sydney" }, { /* (UTC+04:00) Baku */ @@ -825,7 +827,7 @@ static const struct { /* (UTC-03:00) Salvador */ "Bahia Standard Time", "Bahia Daylight Time", - "America/Salvador" + "America/Bahia" }, { /* (UTC+06:00) Dhaka */ @@ -850,7 +852,7 @@ static const struct { /* (UTC-06:00) Saskatchewan */ "Canada Central Standard Time", "Canada Central Daylight Time", - "Canada/Saskatchewan" + "America/Regina" }, { /* (UTC-01:00) Cape Verde Is. */ @@ -860,7 +862,7 @@ static const struct { /* (UTC+04:00) Yerevan */ "Caucasus Standard Time", "Caucasus Daylight Time", - "Asia/Baku" + "Asia/Yerevan" }, { /* (UTC+09:30) Adelaide */ @@ -876,7 +878,7 @@ static const struct { /* (UTC+06:00) Astana */ "Central Asia Standard Time", "Central Asia Daylight Time", - "Asia/Dhaka" + "Asia/Almaty" }, { /* (UTC-04:00) Cuiaba */ @@ -891,7 +893,7 @@ static const struct { /* (UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb */ "Central European Standard Time", "Central European Daylight Time", - "Europe/Sarajevo" + "Europe/Warsaw" }, { /* (UTC+11:00) Solomon Is., New Caledonia */ @@ -901,7 +903,7 @@ static const struct { /* (UTC-06:00) Central Time (US & Canada) */ "Central Standard Time", "Central Daylight Time", - "US/Central" + "America/Chicago" }, { /* (UTC-06:00) Guadalajara, Mexico City, Monterrey */ @@ -916,7 +918,7 @@ static const struct { /* (UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi */ "China Standard Time", "China Daylight Time", - "Asia/Hong_Kong" + "Asia/Shanghai" }, { /* (UTC) Coordinated Universal Time */ @@ -931,7 +933,7 @@ static const struct { /* (UTC-12:00) International Date Line West */ "Dateline Standard Time", "Dateline Daylight Time", - "Etc/UTC+12" + "Etc/GMT+12" }, { /* (UTC+03:00) Nairobi */ @@ -946,12 +948,12 @@ static const struct { /* (UTC+02:00) Chisinau */ "E. Europe Standard Time", "E. Europe Daylight Time", - "Europe/Bucharest" + "Europe/Chisinau" }, { /* (UTC-03:00) Brasilia */ "E. South America Standard Time", "E. South America Daylight Time", - "America/Araguaina" + "America/Sao_Paulo" }, { /* (UTC-06:00) Easter Island */ @@ -961,12 +963,12 @@ static const struct { /* (UTC-05:00) Eastern Time (US & Canada) */ "Eastern Standard Time", "Eastern Daylight Time", - "US/Eastern" + "America/New_York" }, { /* (UTC-05:00) Chetumal */ "Eastern Standard Time (Mexico)", "Eastern Daylight Time (Mexico)", - "America/Mexico_City" + "America/Cancun" }, { /* (UTC+02:00) Cairo */ @@ -975,7 +977,7 @@ static const struct }, { /* (UTC+05:00) Ekaterinburg */ - "Ekaterinburg Standard Time (RTZ 4)", "Ekaterinburg Daylight Time", + "Ekaterinburg Standard Time", "Ekaterinburg Daylight Time", "Asia/Yekaterinburg" }, { @@ -1004,9 +1006,15 @@ static const struct "America/Godthab" }, { + /* + * Windows uses this zone name in various places that lie near the + * prime meridian, but are not in the UK. However, most people + * probably think that "Greenwich" means UK civil time, or maybe even + * straight-up UTC. Hence, map to Europe/London. + */ /* (UTC+00:00) Monrovia, Reykjavik */ "Greenwich Standard Time", "Greenwich Daylight Time", - "Africa/Casablanca" + "Europe/London" }, { /* (UTC+02:00) Athens, Bucharest */ @@ -1016,12 +1024,12 @@ static const struct { /* (UTC-05:00) Haiti */ "Haiti Standard Time", "Haiti Daylight Time", - "US/Eastern" + "America/Port-au-Prince" }, { /* (UTC-10:00) Hawaii */ "Hawaiian Standard Time", "Hawaiian Daylight Time", - "US/Hawaii" + "Pacific/Honolulu" }, { /* (UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi */ @@ -1035,6 +1043,11 @@ static const struct }, { /* (UTC+02:00) Jerusalem */ + "Israel Standard Time", "Israel Daylight Time", + "Asia/Jerusalem" + }, + { + /* (UTC+02:00) Jerusalem (old spelling of zone name) */ "Jerusalem Standard Time", "Jerusalem Daylight Time", "Asia/Jerusalem" }, @@ -1043,6 +1056,11 @@ static const struct "Jordan Standard Time", "Jordan Daylight Time", "Asia/Amman" }, + { + /* (UTC+02:00) Kaliningrad */ + "Kaliningrad Standard Time", "Kaliningrad Daylight Time", + "Europe/Kaliningrad" + }, { /* (UTC+12:00) Petropavlovsk-Kamchatsky - Old */ "Kamchatka Standard Time", "Kamchatka Daylight Time", @@ -1126,7 +1144,7 @@ static const struct { /* (UTC-07:00) Mountain Time (US & Canada) */ "Mountain Standard Time", "Mountain Daylight Time", - "US/Mountain" + "America/Denver" }, { /* (UTC-07:00) Chihuahua, La Paz, Mazatlan */ @@ -1139,7 +1157,7 @@ static const struct "Asia/Rangoon" }, { - /* (UTC+06:00) Novosibirsk (RTZ 5) */ + /* (UTC+07:00) Novosibirsk */ "N. Central Asia Standard Time", "N. Central Asia Daylight Time", "Asia/Novosibirsk" }, @@ -1161,7 +1179,7 @@ static const struct { /* (UTC-03:30) Newfoundland */ "Newfoundland Standard Time", "Newfoundland Daylight Time", - "Canada/Newfoundland" + "America/St_Johns" }, { /* (UTC+11:00) Norfolk Island */ @@ -1169,7 +1187,7 @@ static const struct "Pacific/Norfolk" }, { - /* (UTC+08:00) Irkutsk, Ulaan Bataar */ + /* (UTC+08:00) Irkutsk */ "North Asia East Standard Time", "North Asia East Daylight Time", "Asia/Irkutsk" }, @@ -1201,7 +1219,7 @@ static const struct { /* (UTC-08:00) Pacific Time (US & Canada) */ "Pacific Standard Time", "Pacific Daylight Time", - "US/Pacific" + "America/Los_Angeles" }, { /* (UTC-08:00) Baja California */ @@ -1228,6 +1246,21 @@ static const struct "Romance Standard Time", "Romance Daylight Time", "Europe/Brussels" }, + { + /* (UTC+04:00) Izhevsk, Samara */ + "Russia Time Zone 3", "Russia Time Zone 3", + "Europe/Samara" + }, + { + /* (UTC+11:00) Chokurdakh */ + "Russia Time Zone 10", "Russia Time Zone 10", + "Asia/Srednekolymsk" + }, + { + /* (UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky */ + "Russia Time Zone 11", "Russia Time Zone 11", + "Asia/Kamchatka" + }, { /* (UTC+02:00) Kaliningrad */ "Russia TZ 1 Standard Time", "Russia TZ 1 Daylight Time", @@ -1284,14 +1317,14 @@ static const struct "Asia/Anadyr" }, { - /* (UTC+03:00) Moscow, St. Petersburg, Volgograd */ + /* (UTC+03:00) Moscow, St. Petersburg */ "Russian Standard Time", "Russian Daylight Time", "Europe/Moscow" }, { /* (UTC-03:00) Cayenne, Fortaleza */ "SA Eastern Standard Time", "SA Eastern Daylight Time", - "America/Buenos_Aires" + "America/Cayenne" }, { /* (UTC-05:00) Bogota, Lima, Quito, Rio Branco */ @@ -1301,7 +1334,7 @@ static const struct { /* (UTC-04:00) Georgetown, La Paz, Manaus, San Juan */ "SA Western Standard Time", "SA Western Daylight Time", - "America/Caracas" + "America/La_Paz" }, { /* (UTC-03:00) Saint Pierre and Miquelon */ @@ -1333,10 +1366,20 @@ static const struct "SE Asia Standard Time", "SE Asia Daylight Time", "Asia/Bangkok" }, + { + /* (UTC+08:00) Kuala Lumpur, Singapore */ + "Singapore Standard Time", "Singapore Daylight Time", + "Asia/Singapore" + }, { /* (UTC+02:00) Harare, Pretoria */ "South Africa Standard Time", "South Africa Daylight Time", - "Africa/Harare" + "Africa/Johannesburg" + }, + { + /* (UTC+02:00) Juba */ + "South Sudan Standard Time", "South Sudan Daylight Time", + "Africa/Juba" }, { /* (UTC+05:30) Sri Jayawardenepura */ @@ -1395,61 +1438,66 @@ static const struct }, { /* (UTC-05:00) Turks and Caicos */ - "Turks and Caicos Standard Time", "Turks and Caicos Daylight Time", + "Turks And Caicos Standard Time", "Turks And Caicos Daylight Time", "America/Grand_Turk" }, { /* (UTC+08:00) Ulaanbaatar */ "Ulaanbaatar Standard Time", "Ulaanbaatar Daylight Time", - "Asia/Ulaanbaatar", + "Asia/Ulaanbaatar" }, { /* (UTC-05:00) Indiana (East) */ "US Eastern Standard Time", "US Eastern Daylight Time", - "US/Eastern" + "America/Indianapolis" }, { /* (UTC-07:00) Arizona */ "US Mountain Standard Time", "US Mountain Daylight Time", - "US/Arizona" + "America/Phoenix" + }, + { + /* (UTC) Coordinated Universal Time */ + "UTC", "UTC", + "UTC" }, { /* (UTC+12:00) Coordinated Universal Time+12 */ "UTC+12", "UTC+12", - "Etc/GMT+12" + "Etc/GMT-12" }, { /* (UTC+13:00) Coordinated Universal Time+13 */ "UTC+13", "UTC+13", - "Etc/GMT+13" + "Etc/GMT-13" }, { /* (UTC-02:00) Coordinated Universal Time-02 */ "UTC-02", "UTC-02", - "Etc/GMT-02" + "Etc/GMT+2" }, { /* (UTC-08:00) Coordinated Universal Time-08 */ "UTC-08", "UTC-08", - "Etc/GMT-08" + "Etc/GMT+8" }, { /* (UTC-09:00) Coordinated Universal Time-09 */ "UTC-09", "UTC-09", - "Etc/GMT-09" + "Etc/GMT+9" }, { /* (UTC-11:00) Coordinated Universal Time-11 */ "UTC-11", "UTC-11", - "Etc/GMT-11" + "Etc/GMT+11" }, { /* (UTC-04:00) Caracas */ "Venezuela Standard Time", "Venezuela Daylight Time", - "America/Caracas", + "America/Caracas" }, { - /* (UTC+10:00) Vladivostok (RTZ 9) */ + /* (UTC+10:00) Vladivostok */ "Vladivostok Standard Time", "Vladivostok Daylight Time", "Asia/Vladivostok" }, @@ -1463,14 +1511,11 @@ static const struct "W. Australia Standard Time", "W. Australia Daylight Time", "Australia/Perth" }, -#ifdef NOT_USED - /* Could not find a match for this one (just a guess). Excluded for now. */ { /* (UTC+01:00) West Central Africa */ "W. Central Africa Standard Time", "W. Central Africa Daylight Time", - "WAT" + "Africa/Lagos" }, -#endif { /* (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna */ "W. Europe Standard Time", "W. Europe Daylight Time", @@ -1484,13 +1529,18 @@ static const struct { /* (UTC+05:00) Ashgabat, Tashkent */ "West Asia Standard Time", "West Asia Daylight Time", - "Asia/Karachi" + "Asia/Tashkent" }, { /* (UTC+02:00) Gaza, Hebron */ "West Bank Gaza Standard Time", "West Bank Gaza Daylight Time", "Asia/Gaza" }, + { + /* (UTC+02:00) Gaza, Hebron */ + "West Bank Standard Time", "West Bank Daylight Time", + "Asia/Hebron" + }, { /* (UTC+10:00) Guam, Port Moresby */ "West Pacific Standard Time", "West Pacific Daylight Time", @@ -1501,6 +1551,11 @@ static const struct "Yakutsk Standard Time", "Yakutsk Daylight Time", "Asia/Yakutsk" }, + { + /* (UTC-07:00) Yukon */ + "Yukon Standard Time", "Yukon Daylight Time", + "America/Whitehorse" + }, { NULL, NULL, NULL }