diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 51fa3ccd03..e26ee3c9ee 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -50,9 +50,23 @@ ALLOWED_HOSTS = [] | |||
50 | # although not all choices may be available on all operating systems. | 50 | # although not all choices may be available on all operating systems. |
51 | # In a Windows environment this must be set to your system time zone. | 51 | # In a Windows environment this must be set to your system time zone. |
52 | 52 | ||
53 | # Always use local computer's time zone | 53 | # Always use local computer's time zone, find |
54 | import time | 54 | import os, hashlib |
55 | TIME_ZONE = time.tzname[0] | 55 | if 'TZ' in os.environ: |
56 | TIME_ZONE = os.environ['TZ'] | ||
57 | else: | ||
58 | # need to read the /etc/localtime file which is the libc standard | ||
59 | # and do a reverse-mapping to /usr/share/zoneinfo/; | ||
60 | # since the timezone may match any number of identical timezone definitions, | ||
61 | |||
62 | zonefilelist = {} | ||
63 | ZONEINFOPATH = '/usr/share/zoneinfo/' | ||
64 | for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): | ||
65 | for fn in filenames: | ||
66 | filepath = os.path.join(dirpath, fn) | ||
67 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = filepath.lstrip(ZONEINFOPATH).strip() | ||
68 | |||
69 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] | ||
56 | 70 | ||
57 | # Language code for this installation. All choices can be found here: | 71 | # Language code for this installation. All choices can be found here: |
58 | # http://www.i18nguy.com/unicode/language-identifiers.html | 72 | # http://www.i18nguy.com/unicode/language-identifiers.html |