summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-02 11:44:02 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2021-03-02 11:44:02 +0000
commit0fe5d0f60df11203be9a5ace1ead2895759f456a (patch)
tree530ba12aa49bf99402434ce1838cf405dbb9a53c /time.c
parent34768ea9df63abd5fd9b10553bbd23da52365018 (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.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/time.c b/time.c
index 75db5540c9..2ce9522081 100644
--- a/time.c
+++ b/time.c
@@ -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);
}