summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/hash.c b/hash.c
index 6b3f844095..0b3745cf6e 100644
--- a/hash.c
+++ b/hash.c
@@ -4711,6 +4711,17 @@ env_delete(VALUE name)
nam = env_name(name);
val = getenv(nam);
+
+ /*
+ * ENV['TZ'] = nil has a special meaning.
+ * TZ is no longer considered up-to-date and ruby call tzset() as needed.
+ * It could be useful if sysadmin change /etc/localtime.
+ * This hack might works only on Linux glibc.
+ */
+ if (ENVMATCH(nam, TZ_ENV)) {
+ ruby_tz_uptodate_p = FALSE;
+ }
+
if (val) {
VALUE value = env_str_new2(val);
@@ -4718,9 +4729,6 @@ env_delete(VALUE name)
if (ENVMATCH(nam, PATH_ENV)) {
RB_GC_GUARD(name);
}
- else if (ENVMATCH(nam, TZ_ENV)) {
- ruby_tz_uptodate_p = false;
- }
return value;
}
return Qnil;