Issue Type: Bug Bug
Affects Versions: JRuby 1.7.0.RC2
Assignee: Thomas E Enebo
Created: 17/Oct/12 9:42 PM
Description:

Steps to reproduce:

1. Create a time object with fractional microseconds:

t = Time.new(2012, 10, 17, 23, 59, 59, 999999.9)

2. Add 1 to time, and convert to an integer. Result is off by one:

(t + 1).to_i - t.to_i #=> 2

Impact:

ActiveSupport's extensions to the Time class utilize fractional microseconds in the #end_of_day method. When Time objects created with this method are converted back to DateTime objects (via the TZInfo library), the result is a DateTime object with a value for the start of the next day. This can lead to issues with generating intervals for a full day (i.e. resulting in 97 15-minute intervals per day instead of 96). For example:

Time.now.in_time_zone('America/New_York').end_of_day.to_datetime
#=> Thu, 18 Oct 2012 00:00:00 -0400

Regression:

This functioned as expected in JRuby 1.6.7.2:

> RUBY_ENGINE
=> "jruby"
> RUBY_VERSION
=> "1.9.2"
> JRUBY_VERSION
=> "1.6.7.2"
> t = Time.new(2012, 10, 17, 23, 59, 59, 999999.9)
=> 2012-10-17 23:59:59 +0300
> (t + 1).to_i - t.to_i
=> 1

Project: JRuby
Priority: Critical Critical
Reporter: Joshua Ballanco
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