Skip to content

Time.new: the UTC offset is always negative #591

@janaz

Description

@janaz

Time.now in JRuby 1.7.3 is not working as expected.
When the UTC offset passed to the Time.new is a positive value (i.e. "+12:34"), it is converted to a negative offset("-12:34").

Here is an example where I compared outputs from MRI 1.9.2 and JRuby 1.7.3

Ruby 1.9.2:

1.9.2p320 :009 > RUBY_VERSION
=> "1.9.2"
1.9.2p320 :011 > Time.new(2012, 10, 19, nil, nil, nil, "+03:00").utc_offset
=> 10800

Jruby 1.7.3

irb(main):036:0> JRUBY_VERSION
=> "1.7.3"
irb(main):038:0> Time.new(2012, 10, 19, nil, nil, nil, "+03:00").utc_offset
=> -10800

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions