Project

General

Profile

Bug #13710

Time zone info lost after doing +/- on time object that loaded from dumped string.

Added by Cantin (Cantin Xu) 5 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]
[ruby-core:81892]

Description

See script below.

Time#zone return nil after doing +/- on instance b (which is loaded from dumped string)

a = Marshal.dump(Time.now)
b = Marshal.load(a)
p b.zone  # CST
p (b + 1).zone # nil
p (b - 1).zone # nil
p (Time.now + 1).zone # CST

Associated revisions

Revision 59258
Added by nobu (Nobuyoshi Nakada) 5 months ago

time.c: preserve marshalled timezone

  • time.c (time_add): preserve timezone name restored by Marshal.
    [Bug #13710]

  • time.c (time_mload): reset localtime if having timezone.

History

#1 Updated by nobu (Nobuyoshi Nakada) 5 months ago

  • Status changed from Open to Closed

Applied in changeset trunk|r59258.


time.c: preserve marshalled timezone

  • time.c (time_add): preserve timezone name restored by Marshal.
    [Bug #13710]

  • time.c (time_mload): reset localtime if having timezone.

Also available in: Atom PDF