mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
merge revision(s) 99a9c3fe2e
: [Backport #17024]
Fixed yday and wday with timezone [Bug #17024]
This commit is contained in:
parent
13d2ab0d88
commit
4be9bf1f67
4 changed files with 17 additions and 6 deletions
13
time.c
13
time.c
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue