summaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-07-06 22:13:11 +0000
committerRich Felker <dalias@aerifal.cx>2015-07-06 22:13:11 +0000
commit2a780aa3050b86d888489361f04220bfb58890a1 (patch)
tree44106ec5c29eb2c7e5d38a15614534cacb048c31 /src/time
parent8f08a58c635bea5cdfae6bc0e323c80aa9ff82a7 (diff)
downloadmusl-2a780aa3050b86d888489361f04220bfb58890a1.tar.gz
treat empty TZ environment variable as GMT rather than default
this improves compatibility with the behavior of other systems and with some applications which set an empty TZ var to disable use of local time by mktime, etc.
Diffstat (limited to 'src/time')
-rw-r--r--src/time/__tz.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/time/__tz.c b/src/time/__tz.c
index 13cb1aed..102c8bc7 100644
--- a/src/time/__tz.c
+++ b/src/time/__tz.c
@@ -125,7 +125,8 @@ static void do_tzset()
"/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0";
s = getenv("TZ");
- if (!s || !*s) s = "/etc/localtime";
+ if (!s) s = "/etc/localtime";
+ if (!*s) s = __gmt;
if (old_tz && !strcmp(s, old_tz)) return;