[Sugar-devel] [PATCH] revise timezone list, #2195
James Cameron
quozl at laptop.org
Sun Mar 20 23:09:27 EDT 2011
- remove GMT offsets as useless, since GMT tracks UTC and this is not
expected to change,
- fix #2195 by translating from ISO 8601 to POSIX.1 format, by
reversing the sign,
- increase UTC timezone coverage for Kiribati and Tonga.
References:
http://en.wikipedia.org/wiki/ISO_8601#Time_zone_designators
http://www.gnu.org/s/libc/manual/html_node/TZ-Variable.html
---
v0, a trivial fix for distributed solar panel logging for Richard Smith,
workaround is to avoid the UTC- and UTC+ entries in the timezone list.
extensions/cpsection/datetime/model.py | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/extensions/cpsection/datetime/model.py b/extensions/cpsection/datetime/model.py
index 84e1259..316ac80 100644
--- a/extensions/cpsection/datetime/model.py
+++ b/extensions/cpsection/datetime/model.py
@@ -51,17 +51,9 @@ def read_all_timezones(fn=_zone_tab):
timezones.append(line[2])
timezones.sort()
- for offset in xrange(-12, 13):
+ for offset in xrange(-12, 15):
if offset < 0:
- tz = 'GMT%d' % offset
- elif offset > 0:
- tz = 'GMT+%d' % offset
- else:
- tz = 'GMT'
- timezones.append(tz)
- for offset in xrange(-12, 13):
- if offset < 0:
- tz = 'UTC%d' % offset
+ tz = 'UTC-%d' % abs(offset)
elif offset > 0:
tz = 'UTC+%d' % offset
else:
@@ -85,6 +77,11 @@ def set_timezone(timezone):
"""
timezones = read_all_timezones()
if timezone in timezones:
+ if timezone.startswith('UTC+'):
+ timezone = timezone.replace('+', '-')
+ else:
+ if timezone.startswith('UTC-'):
+ timezone = timezone.replace('-', '+')
os.environ['TZ'] = timezone
client = gconf.client_get_default()
client.set_string('/desktop/sugar/date/timezone', timezone)
--
1.7.4.1
--
James Cameron
http://quozl.linux.org.au/
More information about the Sugar-devel
mailing list