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.



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

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

Class Method Details

.from_msgpack_ext(data) ⇒ Object



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

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

Instance Method Details

#to_json(*args) ⇒ Object



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

def to_json(*args)
  @sec.to_s
end

#to_msgpack(io = nil) ⇒ Object



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

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

#to_msgpack_extObject



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

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