Class: LogStash::Codecs::Fluent::EventTime

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/codecs/fluent/event_time.rb

Constant Summary collapse

TYPE =
0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sec, nsec = 0) ⇒ EventTime

Returns a new instance of EventTime.



7
8
9
10
# File 'lib/logstash/codecs/fluent/event_time.rb', line 7

def initialize(sec, nsec = 0)
  @sec = sec
  @nsec = nsec
end

Instance Attribute Details

#nsecObject (readonly)

Returns the value of attribute nsec.



3
4
5
# File 'lib/logstash/codecs/fluent/event_time.rb', line 3

def nsec
  @nsec
end

#secObject (readonly)

Returns the value of attribute sec.



3
4
5
# File 'lib/logstash/codecs/fluent/event_time.rb', line 3

def sec
  @sec
end

Class Method Details

.from_msgpack_ext(data) ⇒ Object



20
21
22
# File 'lib/logstash/codecs/fluent/event_time.rb', line 20

def self.from_msgpack_ext(data)
  new(*data.unpack('NN'))
end

Instance Method Details

#to_json(*args) ⇒ Object



24
25
26
# File 'lib/logstash/codecs/fluent/event_time.rb', line 24

def to_json(*args)
  @sec
end

#to_msgpack(io = nil) ⇒ Object



12
13
14
# File 'lib/logstash/codecs/fluent/event_time.rb', line 12

def to_msgpack(io = nil)
  @sec.to_msgpack(io)
end

#to_msgpack_extObject



16
17
18
# File 'lib/logstash/codecs/fluent/event_time.rb', line 16

def to_msgpack_ext
  [@sec, @nsec].pack('NN')
end