Project

General

Profile

Actions

Bug #15439

closed

Time object's zone generated by Time.getlocal returns a strange value

Added by y-yagi (Yuji Yaginuma) over 5 years ago. Updated over 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0dev (2018-12-17 trunk 66427) [x86_64-linux]
[ruby-core:90627]

Description

Time object's zone generated by Time.getlocal returns a strange value in Ruby 2.6

$ ruby -v -e 'p Time.new.utc.getlocal(0).zone; p Time.new.utc.getlocal(0).utc?
ruby 2.6.0dev (2018-12-17 trunk 66427) [x86_64-linux]
"UTC"
false 

Since utc? is false, I think that it is wrong that the zone becomes "UTC", what about it?

Nil was returning until Ruby 2.5.

ruby -v -e 'p Time.new.utc.getlocal(0).zone; p Time.new.utc.getlocal(0).utc?'
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
nil
false 

Updated by y-yagi (Yuji Yaginuma) over 5 years ago

It does not seem to happen if utc is not used.

$ ruby -ve 'p Time.new.getlocal(0).zone'
ruby 2.6.0dev (2018-12-21 trunk 66474) [x86_64-linux]
nil 

Active Support is affected by this change and the test is broken. If this is intentional, I'll fix the Active Support side.

Actions #2

Updated by nobu (Nobuyoshi Nakada) over 5 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r66520.


time.c: zone in fixoff mode

  • time.c (time_set_utc_offset): reset zone when setting to fixoff
    mode. while previously TZMODE_SET_FIXOFF has reset it always,
    the zone is kept for loaded zone since r65025.
    [ruby-core:90627] [Bug #15439]
Actions

Also available in: Atom PDF

Like0
Like0Like0