diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-28 12:06:34 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-10-28 14:45:19 +0900 |
commit | 1d666ed50f8b4b3779583381882a0b3edd3cff0e (patch) | |
tree | cd685ddea0f9dedb035671b5210ff72131745be9 /time.c | |
parent | 77544caaf46503b8e56d5b37703bfd1e9fb3cbc6 (diff) |
Fix leap day with UTC offset [Bug #18274]
`struct vtm::year` is a Ruby integer instance, but not a C integer
type.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5041
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -784,6 +784,7 @@ static const int8_t leap_year_days_in_month[] = { #define days_in_month_of(leap) ((leap) ? leap_year_days_in_month : common_year_days_in_month) #define days_in_month_in(y) days_in_month_of(leap_year_p(y)) +#define days_in_month_in_v(y) days_in_month_of(leap_year_v_p(y)) #define M28(m) \ (m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \ @@ -2033,7 +2034,7 @@ vtm_add_offset(struct vtm *vtm, VALUE off, int sign) vtm->yday = leap_year_v_p(vtm->year) ? 366 : 365; } else if (vtm->mday == 1) { - const int8_t *days_in_month = days_in_month_in(vtm->year); + const int8_t *days_in_month = days_in_month_in_v(vtm->year); vtm->mon--; vtm->mday = days_in_month[vtm->mon-1]; vtm->yday--; |