Skip to content


Subversion checkout URL

You can clone with
Download ZIP
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...
commit 0bffe0648d7b19ff2b2ca289699982c23a12f455 1 parent 4dd0bf8
@wagnerrp wagnerrp authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 mythtv/bindings/python/MythTV/utility/
9 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')
- else:
+ if name:
fd = open('/usr/share/zoneinfo/' + name)
+ elif os.getenv('TZ'):
+ fd = open('/usr/share/zoneinfo/' + os.getenv('TZ'))
+ else:
+ fd = open('/etc/localtime')
version = self._get_version(fd)
if version == 2:
Please sign in to comment.
Something went wrong with that request. Please try again.