summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-28 14:08:35 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-28 14:08:35 (GMT)
commit4471d4a3e53b8d4171d62db8c6d84c20f9964519 (patch)
treeadaf9b4d62805790d248909222b3d7f0eb2690b7 /time.c
parent2d0833e1017fbf5654425fe55e396fc5acc01f6b (diff)
time.c: rescue find_timezone when loading
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/time.c b/time.c
index 9e0d541..21b9fec 100644
--- a/time.c
+++ b/time.c
@@ -4965,6 +4965,26 @@ time_dump(int argc, VALUE *argv, VALUE time)
return str;
}
+static VALUE
+mload_findzone(VALUE arg)
+{
+ VALUE *argp = (VALUE *)arg;
+ VALUE time = argp[0], zone = argp[1];
+ return find_timezone(time, zone);
+}
+
+static VALUE
+mload_zone(VALUE time, VALUE zone)
+{
+ VALUE z, args[2];
+ args[0] = time;
+ args[1] = zone;
+ z = rb_rescue(mload_findzone, (VALUE)args, (VALUE (*)(ANYARGS))NULL, Qnil);
+ if (NIL_P(z)) return rb_fstring(zone);
+ if (RB_TYPE_P(z, T_STRING)) return rb_fstring(z);
+ return z;
+}
+
/* :nodoc: */
static VALUE
time_mload(VALUE time, VALUE str)
@@ -5079,8 +5099,7 @@ end_submicro: ;
time_fixoff(time);
}
if (!NIL_P(zone)) {
- VALUE z = find_timezone(time, zone);
- zone = NIL_P(z) ? rb_fstring(zone) : RB_TYPE_P(z, T_STRING) ? rb_fstring(z) : z;
+ zone = mload_zone(time, zone);
tobj->vtm.zone = zone;
}