Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0.pre1
Assignee: Unassigned
Components: Core Classes/Modules
Created: 02/Aug/12 10:34 AM
Description:

JRuby 1.7.0 Time::utc rounds up nanoseconds, JRuby 1.6.7 does not:

jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_05) [Windows 7-amd64-java]
C:\>jruby --1.9 -e 'p Time.utc(2012,7,31,23,59,59,999999.999)'
2012-07-31 23:59:59 UTC

jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-19 00c8c98) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_05) [Windows 7-amd64-java]
C:\>jruby --1.9 -e 'p Time.utc(2012,7,31,23,59,59,999999.999)'
2012-08-01 00:00:00 UTC

The rounding causes Rails to create the wrong date when using Time.end_of_month since Rails uses the time of '23,59,59,999999.999' to create the time on the last day of the month, so Time.end_of_month returns the first of the next month.

Also, JRuby 1.7.0 Time#getutc creates incorrect time with sub-milliseconds, JRuby 1.6.7 is correct:

jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_05) [Windows 7-amd64-java]
C:\>jruby --1.9 -e 'p Time.at(1234441536.123456).getutc.to_f'
1234441536.123456

jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-19 00c8c98) (Java HotSpot(TM) 64-Bit Server VM 1.7.0_05) [Windows 7-amd64-java]
C:\>jruby --1.9 -e 'p Time.at(1234441536.123456).getutc.to_f'
1234441536.1230004

Project: JRuby
Priority: Major Major
Reporter: Tim Hayman
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to