diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-12-05 16:41:52 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-12-05 16:41:52 +0300 |
commit | 4c2380d396326bc76ccf4c640d91e26d48b4fe30 (patch) | |
tree | 1fb986943738219c60280e3776ff2ed44b2f66b7 /winsup/utils/tzmap-from-unicode.org | |
parent | a800b3ae9c99212ad7174d03b025db898ddb5574 (diff) |
* Makefile.in: Add rules to create and depend on tzmap.h.
* tzmap-from-unicode.org: New script to create tzmap.h.
* tzmap.h: New auto-generated file.
* tzset.c: Drop tzmap from here and include tzmap.h instead. Drop
Windows 2000 considerations.
Diffstat (limited to 'winsup/utils/tzmap-from-unicode.org')
-rwxr-xr-x | winsup/utils/tzmap-from-unicode.org | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/winsup/utils/tzmap-from-unicode.org b/winsup/utils/tzmap-from-unicode.org new file mode 100755 index 000000000..9e713c3b2 --- /dev/null +++ b/winsup/utils/tzmap-from-unicode.org @@ -0,0 +1,85 @@ +#!/bin/bash +# +# tzset-from-unicode.org +# +# Fetch XML file containing mapping of Windows timezone keynames and countries +# per ISO 3166-1 to POSIX timezones from unicode.org. +# +# Create the table file as required by tzset.c. +# + +ZONES_FILE="http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml" + +echo "/*" +echo " This file gets auto-generated by the script tzmap-from-unicode.org via" +echo " a Makefile rule. To regenerate the file, just call 'make tzmap'. It" +echo " fetches the file" +echo "" +echo " ${ZONES_FILE}" +echo "" +echo " using wget and converts it into the tzmap table required by tzget.c." +echo " Regenerating might be necessary on a regular basis..." +echo "" +echo " This table maps Windows timezone keynames and countries per ISO 3166-1 to" +echo " POSIX-compatible timezone IDs." +echo "" +echo " The mapping from unicode.org is just a bit incomplete. It doesn't contain" +echo " a few timezones available on Windows XP, namely:" +echo "" +echo " Armenian Standard Time" +echo " Mexico Standard Time" +echo " Mexico Standard Time 2" +echo "" +echo " as well as the still (Windows 8.1) available" +echo "" +echo " E. Europe Standard Time" +echo " Mid-Atlantic Standard Time" +echo " Kamchatka Standard Time" +echo "" +echo " as well as a few combinations which got a new Windows timezone name" +echo "" +echo " Eastern Standard Time/TC" +echo " Egypt Standard Time/PS" +echo " Greenwich Standard Time/EH" +echo " Hawaiian Standard Time/TK" +echo " Kaliningrad Standard Time/BY" +echo " SA Pacific Standard Time/HT " +echo " South Africa Standard Time/LY" +echo "" +echo " It also doesn't contain some of the deprecated country codes used in older" +echo " OSes, namely:" +echo "" +echo " SP (Serbian, proposed) used in XP" +echo " CS (Serbian and Montenegro, dissolved, now RS and ME) used in Vista" +echo " " +echo " While these are apparently old, they are required here to get a complete" +echo " mapping on all supported OSes. */" +echo "struct" +echo "{" +echo " PCWSTR win_tzkey;" +echo " PCWSTR country;" +echo " PCWSTR posix_tzid;" +echo "} tzmap[] =" +echo "{" +wget -O - "${ZONES_FILE}" | \ +{ + sed -n -e 's#territory="001"#territory=""# + s#.*mapZone other=\("[^"]*"\) territory=\("[^"]*"\) type=\("[^"]*"\).*# { L\1, L\2, L\3 },#p' + echo ' { L"Armenian Standard Time", L"AM", L"Asia/Yerevan" },' + echo ' { L"Central Europe Standard Time", L"CS", L"Europe/Belgrade" },' + echo ' { L"Central Europe Standard Time", L"SP", L"Europe/Belgrade" },' + echo ' { L"E. Europe Standard Time", L"", L"Asia/Nicosia" },' + echo ' { L"E. Europe Standard Time", L"CY", L"Asia/Nicosia" },' + echo ' { L"Eastern Standard Time", L"TC", L"America/Grand_Turk" },' + echo ' { L"Egypt Standard Time", L"PS", L"Asia/Gaza Asia/Hebron" },' + echo ' { L"Greenwich Standard Time", L"EH", L"Africa/El_Aaiun" },' + echo ' { L"Kaliningrad Standard Time", L"BY", L"Europe/Minsk" },' + echo ' { L"Kamchatka Standard Time", L"", L"Asia/Kamchatka" },' + echo ' { L"Hawaiian Standard Time", L"TK", L"Pacific/Fakaofo" },' + echo ' { L"Mexico Standard Time", L"", L"America/Mexico_City" },' + echo ' { L"Mexico Standard Time 2", L"", L"America/Mazatlan" },' + echo ' { L"Mid-Atlantic Standard Time", L"", L"Atlantic/South_Georgia" },' + echo ' { L"SA Pacific Standard Time", L"HT", L"America/Port-au-Prince" },' + echo ' { L"South Africa Standard Time", L"LY", L"Africa/Tripoli" },' +} | sort -d +echo "};" |