ankiit / logstash

Automatically exported from code.google.com/p/logstash
0 stars 0 forks source link

Ruby 'DateTime#sec_fraction' is inconsistent across versions. #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

In 1.8.7, DateTime#sec_fraction is fractions of a day. In 1.9.2, sec_fraction 
is fractions of a second.

Code:
  require "date"
  p [RUBY_PLATFORM, RUBY_VERSION, DateTime.parse("2001-01-01T00:00:00.1234").sec_fraction]

Output:
["x86_64-linux", "1.9.2", (617/5000)]
["java", "1.8.7", Rational(617, 432000000)]
["x86_64-linux", "1.8.7", Rational(617, 432000000)]

1.8.6 fails completely to parse this time format.

I may need to reimplement some/all of the time parsing we do so it becomes 
reliable across ruby versions.

Original issue reported on code.google.com by jls.semi...@gmail.com on 18 Jan 2011 at 9:15

GoogleCodeExporter commented 9 years ago
Behavior on 1.9.1 and 1.9.2 are similar.

["x86_64-linux", "1.9.1", (617/5000)]

Original comment by jls.semi...@gmail.com on 18 Jan 2011 at 9:18

GoogleCodeExporter commented 9 years ago
Reduced priority and changed milestone.

We have decided to not support ruby 1.9.x right now because the core ruby 
library changes quite wildly between 1.8.x and 1.9.x (in both documented *and* 
undocumented ways) that it makes spending energy on 1.9.x not realistic for 1.0.

Original comment by jls.semi...@gmail.com on 3 Feb 2011 at 10:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fixed. JRuby gives us java access and we now use the Joda-Time library for date 
mangling.

Original comment by jls.semi...@gmail.com on 19 Mar 2011 at 4:07