Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.7.0.pre1
-
Fix Version/s: JRuby 1.7.0.pre2
-
Component/s: Core Classes/Modules
-
Labels:None
-
Number of attachments :
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.
Issue Links
- relates to
-
JRUBY-6631
Time#nsec always returns 0
-
Separating the two distinct issues.