Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get zone from RubyTime (fixes #3303) #3309

Closed
wants to merge 1 commit into from

Conversation

tdaitx
Copy link
Contributor

@tdaitx 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.

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
@headius
Copy link
Member

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.

@tdaitx
Copy link
Contributor Author

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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strftime_spec.rb SPEC test fails in "returns the timezone with %Z"
3 participants