Browse files

Allow posixtzinfo to use the TZ environmental variable.

This adds a check for the TZ environmental variable, and uses that to
define the local timezone if available, rather than always using
/etc/localtime. This resolves an issue on Debian-based systems that
always use the TZ variable, rather than defining the localtime file.
  • Loading branch information...
wagnerrp committed Dec 30, 2012
1 parent 4dd0bf8 commit 0bffe0648d7b19ff2b2ca289699982c23a12f455
Showing with 6 additions and 3 deletions.
  1. +6 −3 mythtv/bindings/python/MythTV/utility/
@@ -11,6 +11,7 @@
tzinfo as _pytzinfo, \
from collections import namedtuple
import os
import re
import time
import singleton
@@ -177,10 +178,12 @@ def _process(self, fd, version=1, skip=False):
def __init__(self, name=None):
if name is None:
fd = open('/etc/localtime')
if name:
fd = open('/usr/share/zoneinfo/' + name)
elif os.getenv('TZ'):
fd = open('/usr/share/zoneinfo/' + os.getenv('TZ'))
fd = open('/etc/localtime')
version = self._get_version(fd)
if version == 2:

0 comments on commit 0bffe06

Please sign in to comment.