diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-03-02 11:44:02 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2021-03-02 11:44:02 +0000 |
commit | 0fe5d0f60df11203be9a5ace1ead2895759f456a (patch) | |
tree | 530ba12aa49bf99402434ce1838cf405dbb9a53c /time.c | |
parent | 34768ea9df63abd5fd9b10553bbd23da52365018 (diff) |
merge revision(s) 99a9c3fe: [Backport #17024]
Fixed yday and wday with timezone [Bug #17024]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -4322,14 +4322,15 @@ time_wday(VALUE time) GetTimeval(time, tobj); MAKE_TM(time, tobj); + if (tobj->vtm.wday == VTM_WDAY_INITVAL) { + VALUE zone = tobj->vtm.zone; + if (!NIL_P(zone)) zone_localtime(zone, time); + } return INT2FIX((int)tobj->vtm.wday); } #define wday_p(n) {\ - struct time_object *tobj;\ - GetTimeval(time, tobj);\ - MAKE_TM(time, tobj);\ - return (tobj->vtm.wday == (n)) ? Qtrue : Qfalse;\ + return (time_wday(time) == INT2FIX(n)) ? Qtrue : Qfalse; \ } /* @@ -4461,6 +4462,10 @@ time_yday(VALUE time) GetTimeval(time, tobj); MAKE_TM(time, tobj); + if (tobj->vtm.yday == 0) { + VALUE zone = tobj->vtm.zone; + if (!NIL_P(zone)) zone_localtime(zone, time); + } return INT2FIX(tobj->vtm.yday); } |