module LogStash::Time

Provide our own Time wrapper for ISO8601 support Example:

>> LogStash::Time.now.to_iso8601
=> "2010-10-17 00:25:24.619014-0700"

>> LogStash::Time.now.utc.to_iso8601
=> "2010-10-17 07:25:26.788704Z"

Constants

ISO8601_STRFTIME
JODA_ISO8601_PARSER

JODA_ISO8601_PARSER = org.joda.time.format.ISODateTimeFormat.dateTimeParser JODA_ISO8601_PARSER = org.joda.time.format.ISODateTimeFormat.dateTimeParser

UTC

Public Class Methods

now() click to toggle source
# File lib/logstash/time_addon.rb, line 13
def self.now
  return Time.new.utc
end
parse_iso8601(t) click to toggle source
# File lib/logstash/time_addon.rb, line 22
def self.parse_iso8601(t)
  millis = JODA_ISO8601_PARSER.parseMillis(t)
  return Time.at(millis / 1000, (millis % 1000) * 1000)
end