get zone from RubyTime (fixes #3303) #3309

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

tdaitx commented Sep 4, 2015

According to the spec spec/ruby/core/time/strftime_spec.rb "%Z" and RubyTime#zone should behave the same:

  it "returns the timezone with %Z" do
    time = Time.local(2009, 9, 18, 12, 0, 0)
    zone = time.zone
    time.strftime("%Z").should == zone
  end

This fixes #3303 by calling RubyTime#zone directly.

get zone from RubyTime (fixes #3303)
According to the spec "%Z" and RubyTime#zone should behave the
same. This fix reuses RubyTime#zone to avoid code duplication.

@tdaitx tdaitx closed this Sep 8, 2015

@tdaitx tdaitx reopened this Sep 8, 2015

Owner

headius commented Sep 8, 2015

Perhaps we could just abstract the 0:00 to UTC logic into a separate method both call? Like getRubyTimeZoneName or something? The fix you have here ends up creating intermediate (and wasteful) Time and String objects on the way to a Java string, just to reuse that timezone-naming logic.

Contributor

tdaitx commented Sep 15, 2015

Closing as a new proposal has been submitted (#3331).

@tdaitx tdaitx closed this Sep 15, 2015

@kares kares added this to the Invalid or Duplicate milestone Sep 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment