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.



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

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

Class Method Details

.from_msgpack_ext(data) ⇒ Object



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

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

Instance Method Details

#to_json(*args) ⇒ Object



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

def to_json(*args)
  @sec.to_s
end

#to_msgpack(io = nil) ⇒ Object



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

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

#to_msgpack_extObject



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

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