diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-08 04:03:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-10-08 04:03:32 +0000 |
commit | fcf308e5fc6e0015a89ac57f6d40fec4bc3d99db (patch) | |
tree | cb5a947db7decdc303dda63630b4191741c2884d /time.c | |
parent | e94b5221c469082040243f155ec2c2e1825db8e7 (diff) |
Timezone at Time#+ and Time#-
* time.c (time_add): support for Timezone.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -3899,6 +3899,11 @@ time_add(struct time_object *tobj, VALUE torig, VALUE offset, int sign) GetTimeval(result, tobj); TZMODE_SET_FIXOFF(tobj, off); } + else if (TZMODE_LOCALTIME_P(tobj)) { + VALUE zone = tobj->vtm.zone; + GetTimeval(result, tobj); + tobj->vtm.zone = zone; + } return result; } @@ -3982,6 +3987,9 @@ rb_time_succ(VALUE time) time = time_new_timew(rb_cTime, wadd(tobj->timew, WINT2FIXWV(TIME_SCALE))); GetTimeval(time, tobj2); TZMODE_COPY(tobj2, tobj); + if (TZMODE_LOCALTIME_P(tobj2) && maybe_tzobj_p(tobj2->vtm.zone)) { + zone_localtime(tobj2->vtm.zone, time); + } return time; } |