Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Commit

Permalink
fix jruby bigdecimal handling in Time.at
Browse files Browse the repository at this point in the history
  • Loading branch information
colinsurprenant committed May 19, 2016
1 parent 7783f76 commit 5c063fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion logstash-core-event/lib/logstash/timestamp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ def initialize(time = Time.new)
end

def self.at(*args)
Timestamp.new(::Time.at(*args))
epoch = args.first
if epoch.is_a?(BigDecimal)
# bug in JRuby prevents correcly parsing a BigDecimal fractional part, see https://github.com/elastic/logstash/issues/4565
Timestamp.new(::Time.at(epoch.to_i, epoch.frac.to_f * 1000000))
else
Timestamp.new(::Time.at(*args))
end
end

def self.parse(*args)
Expand Down

0 comments on commit 5c063fa

Please sign in to comment.