jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-1555

DST bug in second form of Time.local

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1b1
  • Fix Version/s: JRuby 1.2
  • Component/s: Core Classes/Modules
  • Labels:
    None
  • Environment:
    ruby 1.8.5 (2007-11-11 rev 4842) [i386-jruby1.1b1], OS X 10.4.9, java 1.5

Description

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
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Text File
    rejigger_time_creation.patch
    17/Mar/08 3:25 PM
    9 kB
    Charles Oliver Nutter

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Charles Oliver Nutter added a comment - 16/Nov/07 3:32 PM

Interesting

Show
Charles Oliver Nutter added a comment - 16/Nov/07 3:32 PM Interesting
Hide
Permalink
Daniel Berger added a comment - 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.

Show
Daniel Berger added a comment - 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.
Hide
Permalink
Vladimir Sizikov added a comment - 03/Dec/07 4: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.

Show
Vladimir Sizikov added a comment - 03/Dec/07 4: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.
Hide
Permalink
Charles Oliver Nutter added a comment - 15/Feb/08 12:58 PM

Punting issues from 1.1 RC2 to 1.1 final.

Show
Charles Oliver Nutter added a comment - 15/Feb/08 12:58 PM Punting issues from 1.1 RC2 to 1.1 final.
Hide
Permalink
Charles Oliver Nutter added a comment - 17/Mar/08 3: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.

Show
Charles Oliver Nutter added a comment - 17/Mar/08 3: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.
Hide
Permalink
Charles Oliver Nutter added a comment - 17/Mar/08 3: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.

Show
Charles Oliver Nutter added a comment - 17/Mar/08 3: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.
Hide
Permalink
Charles Oliver Nutter added a comment - 04/Feb/09 1:51 AM

Still broken going into 1.2...here's updated output:

[headius @ cnutter:~/projects/jruby]
$ jruby -e "p Time.local(1,2,3,27,2,2001,'Tue',287,true,'MST')"
Tue Feb 27 02:02:01 -0700 2001
[headius @ cnutter:~/projects/jruby]
$ ruby -e "p Time.local(1,2,3,27,2,2001,'Tue',287,true,'MST')"
Tue Feb 27 02:02:01 -0600 2001
Show
Charles Oliver Nutter added a comment - 04/Feb/09 1:51 AM Still broken going into 1.2...here's updated output:
[headius @ cnutter:~/projects/jruby]
$ jruby -e "p Time.local(1,2,3,27,2,2001,'Tue',287,true,'MST')"
Tue Feb 27 02:02:01 -0700 2001
[headius @ cnutter:~/projects/jruby]
$ ruby -e "p Time.local(1,2,3,27,2,2001,'Tue',287,true,'MST')"
Tue Feb 27 02:02:01 -0600 2001
Hide
Permalink
Charles Oliver Nutter added a comment - 04/Feb/09 2:28 AM

On second inspection it appears that JRuby's output is actually more correct than MRI's...MST is always supposed to be -0700, not ever -0600. So I'm going to knock this one off as resolved since it seems like we're talking solely about a display issue that's probably fuzzy anyway. If there's a real issue here, like that we're not accurately representing time internally, open a separate issue.

Show
Charles Oliver Nutter added a comment - 04/Feb/09 2:28 AM On second inspection it appears that JRuby's output is actually more correct than MRI's...MST is always supposed to be -0700, not ever -0600. So I'm going to knock this one off as resolved since it seems like we're talking solely about a display issue that's probably fuzzy anyway. If there's a real issue here, like that we're not accurately representing time internally, open a separate issue.

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Daniel Berger
Vote (0)
Watch (5)

Dates

  • Created:
    11/Nov/07 9:04 AM
    Updated:
    21/Mar/09 1:14 PM
    Resolved:
    04/Feb/09 2:28 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.