diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-28 14:08:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-28 14:08:35 +0000 |
commit | 4471d4a3e53b8d4171d62db8c6d84c20f9964519 (patch) | |
tree | adaf9b4d62805790d248909222b3d7f0eb2690b7 /time.c | |
parent | 2d0833e1017fbf5654425fe55e396fc5acc01f6b (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.c | 23 |
1 files changed, 21 insertions, 2 deletions
@@ -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; } |