summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-01-06 09:58:22 -0200
committerRenato Botelho <renato@netgate.com>2017-01-06 09:59:31 -0200
commitc99119763957cb697c67df90fef114e32f5de170 (patch)
tree4c6d510b67be9ed72287414aaef2a3de23b6b9d2 /src
parent50af3592831e8b29d469eb259811426a46e42347 (diff)
downloadpfsense-c99119763957cb697c67df90fef114e32f5de170.zip
pfsense-c99119763957cb697c67df90fef114e32f5de170.tar.gz
Ticket #7089 Enhance Etc/GMT timezone descriptions
These work opposite to the way mere mortals expect. Read: https://github.com/eggert/tz/blob/master/etcetera Based on @phil-davis' patch from https://github.com/pfsense/pfsense/pull/3354
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/system.php36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php
index ef15bd1..1fa9554 100644
--- a/src/usr/local/www/system.php
+++ b/src/usr/local/www/system.php
@@ -125,6 +125,40 @@ if ($pconfig['timezone'] <> $_POST['timezone']) {
}
$timezonelist = system_get_timezone_list();
+$timezonedesc = $timezonelist;
+
+/*
+ * Etc/GMT entries work the opposite way to what people expect.
+ * Ref: https://github.com/eggert/tz/blob/master/etcetera and Redmine issue 7089
+ * Add explanatory text to entries like:
+ * Etc/GMT+1 and Etc/GMT-1
+ * but not:
+ * Etc/GMT or Etc/GMT+0
+ */
+foreach ($timezonedesc as $idx => $desc) {
+ if (substr($desc, 0, 7) != "Etc/GMT" || substr($desc, 8, 1) == "0") {
+ continue;
+ }
+
+ $direction = substr($desc, 7, 1);
+
+ switch ($direction) {
+ case '-':
+ $direction_str = gettext('AHEAD');
+ break;
+ case '+':
+ $direction_str = gettext('BEHIND');
+ break;
+ default:
+ continue;
+ }
+
+ $hr_offset = substr($desc, 8);
+ $plural = $hr_offset == "1" ? "" : "s";
+
+ $timezonedesc[$idx] = $desc . " " . sprintf(gettext(
+ "(%s hour%s %s GMT)"), $hr_offset, $plural, $direction_str);
+}
$multiwan = false;
$interfaces = get_configured_interface_list();
@@ -487,7 +521,7 @@ $section->addInput(new Form_Select(
'timezone',
'Timezone',
$pconfig['timezone'],
- array_combine($timezonelist, $timezonelist)
+ array_combine($timezonelist, $timezonedesc)
))->setHelp('Select the timezone or location within the timezone to be used by this system. '.
'Usually choose a "Continent/City". Only choose a special or "Etc" entry if you understand why you need to use it.');
OpenPOWER on IntegriCloud