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(sec, nsec = 0) ⇒ EventTime

Returns a new instance of EventTime.



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

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

Class Method Details

.from_msgpack_ext(data) ⇒ Object



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

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

Instance Method Details

#to_json(*args) ⇒ Object



49
50
51
# File 'lib/fluent/logger/fluent_logger.rb', line 49

def to_json(*args)
  @sec.to_s
end

#to_msgpack(io = nil) ⇒ Object



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

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

#to_msgpack_extObject



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

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