Path: blob/master/resources/timezones/generate-timezone-map.php
12240 views
#!/usr/bin/env php1<?php23$root = dirname(dirname(dirname(__FILE__)));4require_once $root.'/scripts/init/init-script.php';56$xml = $root.'/externals/cldr/cldr_windows_timezones.xml';7$xml = Filesystem::readFile($xml);8$xml = new SimpleXMLElement($xml);910$result_map = array();1112$ignore = array(13'UTC',14'UTC-11',15'UTC-02',16'UTC-08',17'UTC-09',18'UTC+12',19);20$ignore = array_fuse($ignore);2122$zones = $xml->windowsZones->mapTimezones->mapZone;23foreach ($zones as $zone) {24$windows_name = (string)$zone['other'];25$target_name = (string)$zone['type'];2627// Ignore the offset-based timezones from the CLDR map, since we handle28// these later.29if (isset($ignore[$windows_name])) {30continue;31}3233// We've already seen this timezone so we don't need to add it to the map34// again.35if (isset($result_map[$windows_name])) {36continue;37}3839$result_map[$windows_name] = $target_name;40}4142asort($result_map);4344echo id(new PhutilJSON())45->encodeFormatted($result_map);464748