merge revision(s) 99a9c3fe2e: [Backport #17024]

Fixed yday and wday with timezone [Bug #17024]
This commit is contained in:
nagachika 2020-07-23 11:33:11 +09:00
parent 13d2ab0d88
commit 4be9bf1f67
4 changed files with 17 additions and 6 deletions

13
time.c
View file

@ -4558,14 +4558,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; \
}
/*
@ -4697,6 +4698,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);
}