diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-04 20:56:28 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-04 20:56:28 +0000 |
commit | a72f9f34767f9f2a6e8b7e22251949e65d2fe39d (patch) | |
tree | 1cb8dad1e0e7cf166c76ee50402a5f7dae35a2cc /ext | |
parent | d9087ffebca0e5637246d4b8dce35c65d28f40a1 (diff) | |
download | ruby-a72f9f34767f9f2a6e8b7e22251949e65d2fe39d.tar.gz |
* ext/date/date_core.c (rt_rewrite_frags): a new feature (not a
bug fix) of strptime. applies offset even if the given date is
not local time (%s and %Q). This is an exceptional feature and
I do NOT recommend to use this at all. Thank you git community.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/date/date_core.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c index 1685d15e61..ee360b4afb 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -1,5 +1,5 @@ /* - date_core.c: Coded by Tadayoshi Funaba 2010-2013 + date_core.c: Coded by Tadayoshi Funaba 2010-2014 */ #include "ruby.h" @@ -3667,7 +3667,11 @@ rt_rewrite_frags(VALUE hash) seconds = ref_hash("seconds"); if (!NIL_P(seconds)) { - VALUE d, h, min, s, fr; + VALUE offset, d, h, min, s, fr; + + offset = ref_hash("offset"); + if (!NIL_P(offset)) + seconds = f_add(seconds, offset); d = f_idiv(seconds, INT2FIX(DAY_IN_SECONDS)); fr = f_mod(seconds, INT2FIX(DAY_IN_SECONDS)); @@ -3687,7 +3691,6 @@ rt_rewrite_frags(VALUE hash) set_hash("sec", s); set_hash("sec_fraction", fr); del_hash("seconds"); - del_hash("offset"); } return hash; } |