Skip to content

Commit 6312c40

Browse files
jhawthornk0kubun
authored andcommitted
Write barrier for zone on time
1 parent c2bda5c commit 6312c40

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

time.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,14 +2283,14 @@ utc_offset_arg(VALUE arg)
22832283

22842284
static void
22852285
zone_set_offset(VALUE zone, struct time_object *tobj,
2286-
wideval_t tlocal, wideval_t tutc)
2286+
wideval_t tlocal, wideval_t tutc, VALUE time)
22872287
{
22882288
/* tlocal and tutc must be unmagnified and in seconds */
22892289
wideval_t w = wsub(tlocal, tutc);
22902290
VALUE off = w2v(w);
22912291
validate_utc_offset(off);
2292-
tobj->vtm.utc_offset = off;
2293-
tobj->vtm.zone = zone;
2292+
RB_OBJ_WRITE(time, &tobj->vtm.utc_offset, off);
2293+
RB_OBJ_WRITE(time, &tobj->vtm.zone, zone);
22942294
TZMODE_SET_LOCALTIME(tobj);
22952295
}
22962296

@@ -2405,7 +2405,7 @@ zone_timelocal(VALUE zone, VALUE time)
24052405
if (UNDEF_P(utc)) return 0;
24062406

24072407
s = extract_time(utc);
2408-
zone_set_offset(zone, tobj, t, s);
2408+
zone_set_offset(zone, tobj, t, s, time);
24092409
s = rb_time_magnify(s);
24102410
if (tobj->vtm.subsecx != INT2FIX(0)) {
24112411
s = wadd(s, v2w(tobj->vtm.subsecx));
@@ -2434,7 +2434,7 @@ zone_localtime(VALUE zone, VALUE time)
24342434

24352435
s = extract_vtm(local, time, tobj, subsecx);
24362436
tobj->vtm.tm_got = 1;
2437-
zone_set_offset(zone, tobj, s, t);
2437+
zone_set_offset(zone, tobj, s, t, time);
24382438
zone_set_dst(zone, tobj, tm);
24392439

24402440
RB_GC_GUARD(time);
@@ -5725,7 +5725,7 @@ end_submicro: ;
57255725
}
57265726
if (!NIL_P(zone)) {
57275727
zone = mload_zone(time, zone);
5728-
tobj->vtm.zone = zone;
5728+
RB_OBJ_WRITE(time, &tobj->vtm.zone, zone);
57295729
zone_localtime(zone, time);
57305730
}
57315731

0 commit comments

Comments
 (0)