Class: Fluent::Logger::EventTime

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/logger/fluent_logger.rb

Constant Summary collapse

TYPE =
0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_time) ⇒ EventTime

Returns a new instance of EventTime.



29
30
31
# File 'lib/fluent/logger/fluent_logger.rb', line 29

def initialize(raw_time)
  @time = raw_time
end

Class Method Details

.from_msgpack_ext(data) ⇒ Object



41
42
43
# File 'lib/fluent/logger/fluent_logger.rb', line 41

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

Instance Method Details

#to_json(*args) ⇒ Object



45
46
47
# File 'lib/fluent/logger/fluent_logger.rb', line 45

def to_json(*args)
  @time.to_i
end

#to_msgpack(io = nil) ⇒ Object



33
34
35
# File 'lib/fluent/logger/fluent_logger.rb', line 33

def to_msgpack(io = nil)
  @time.to_i.to_msgpack(io)
end

#to_msgpack_extObject



37
38
39
# File 'lib/fluent/logger/fluent_logger.rb', line 37

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