History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-1555
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Daniel Berger
Votes: 0
Watchers: 5
Operations

If you were logged in you would be able to see more operations.
JRuby

DST bug in second form of Time.local

Created: 11/Nov/07 09:04 AM   Updated: 17/Mar/08 03:26 PM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.1b1
Fix Version/s: JRuby 1.1+

Time Tracking:
Not Specified

File Attachments: 1. Text File rejigger_time_creation.patch (9 kb)

Environment: ruby 1.8.5 (2007-11-11 rev 4842) [i386-jruby1.1b1], OS X 10.4.9, java 1.5


 Description  « Hide
DST bug:
# MRI
irb(main):001:0> Time.local(1,2,3,27,2,2001,'Tue',287,true,'MST')
=> Tue Feb 27 02:02:01 -0700 2001

# JRuby
irb(main):001:0> Time.local(1,2,3,27,2,2001,'Tue',287,true,'MST')
=> Tue Feb 27 03:02:01 MST 2001


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Charles Oliver Nutter - 16/Nov/07 03:32 PM
Interesting

Daniel Berger - 17/Nov/07 11:52 AM
Note that I was referring to the hour difference, not the GMT offset vs string. However, as of revision 4842, it looks like you've switched to GMT offset. Anyway, I still see the bug.

Vladimir Sizikov - 03/Dec/07 04:24 AM
JRuby's RubyTime just ignores the last 4 arguments altogether:

in createTime():

if (args.length == 10) {
args = new IRubyObject[] { args[5], args[4], args[3], args[2], args[1], args[0], runtime.getNil() };
}

So, no matter what is specified in the last 4 arguments, they don't affect the end result of Time.local invocation.

This also leads to one of activesupport unit test failures:

4) Failure:
test_seconds_since_midnight_at_daylight_savings_time_end(TimeExtCalculationsTest)
[/opt/work/activesupport/./test/core_ext/time_ext_test.rb:35:in `test_seconds_since_midnight_at_daylight_savings_time_end'
/opt/work/activesupport/./test/core_ext/time_ext_test.rb:27:in `with_timezone'
/opt/work/activesupport/./test/core_ext/time_ext_test.rb:27:in `test_seconds_since_midnight_at_daylight_savings_time_end'
/opt/work/activesupport/./test/core_ext/time_ext_test.rb:27:in `run']:
before DST end.
<5400> expected but was
<9000.0>.

The test in the activesupport test suite uses the long form of Time.local to set DST flag, and fails, since the flag is ignored.

E.g., with TZ=US/Eastern:

MRI:
Time.local(0,30,1,30,10,2005,0,0,false,ENV['TZ']).dst?
Time.local(0,30,1,30,10,2005,0,0,true,ENV['TZ']).dst?

returns false, true.

JRuby both times returns false.


Charles Oliver Nutter - 15/Feb/08 12:58 PM
Punting issues from 1.1 RC2 to 1.1 final.

Charles Oliver Nutter - 17/Mar/08 03:25 PM
A patch to clean up time creation a bit...it doesn't pass marshalling though, and I haven't time to fix it better.

Charles Oliver Nutter - 17/Mar/08 03:26 PM
Move to post 1.1, since the time stuff is a bit involved at the moment. Good 1.1.1 fix if we get it done.