mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 14:47:19 -04:00
Work around bug where org.joda.time.DateTime.new(DateTimeZone) invokes the Object constructor instead of the DateTimeZone argument constructor.
This commit is contained in:
parent
1898cc4a70
commit
9c264c65e9
1 changed files with 5 additions and 1 deletions
|
@ -14,7 +14,11 @@ module LogStash::Time
|
|||
DateTimeZone = org.joda.time.DateTimeZone
|
||||
def self.now
|
||||
# org.joda.time.DateTime#to_s returns the time in ISO8601 form :)
|
||||
return DateTime.new(DateTimeZone::UTC).to_s
|
||||
# Could call DateTime.new(DateTimeZone::UTC) but JRuby calls the
|
||||
# DateTime#new(Object) constructor instead of the
|
||||
# DateTime#new(DateTimeZone) constructor. I was unable to get java_send to invoke this constructor,
|
||||
# so instead I have to do DateTime#new#withZone(UTC)
|
||||
return DateTime.new.withZone(DateTimeZone::UTC).to_s
|
||||
end # def initialize
|
||||
else
|
||||
# Otherwise, use ruby stdlib Time, which is much slower than Joda.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue