class Fluent::EventTime

def self.eq?(a, b)

def self.eq?(a, b)
  if a.is_a?(Fluent::EventTime) && b.is_a?(Fluent::EventTime)
    a.sec == b.sec && a.nsec == b.nsec
  else
    a == b
  end
end

def self.from_msgpack_ext(data)

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

def self.from_time(time)

def self.from_time(time)
  Fluent::EventTime.new(time.to_i, time.nsec)
end

def self.now

def self.now
  from_time(Time.now)
end

def self.parse(*args)

def self.parse(*args)
  from_time(Time.parse(*args))
end

def ==(other)

def ==(other)
  if other.is_a?(Fluent::EventTime)
    @sec == other.sec
  else
    @sec == other
  end
end

def coerce(other)

for > and others
def coerce(other)
  [other, @sec]
end

def initialize(sec, nsec = 0)

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

def inspect

def inspect
  FORMATTER.exec(Time.at(self))
end

def method_missing(name, *args, &block)

# TODO: For performance, implement +, -, and so on
def method_missing(name, *args, &block)
  @sec.send(name, *args, &block)
end

def nsec

def nsec
  @nsec
end

def sec

def sec
  @sec
end

def to_f

def to_f
  @sec + @nsec / 1_000_000_000.0
end

def to_int

def to_int
  @sec
end

def to_json(*args)

def to_json(*args)
  @sec.to_s
end

def to_msgpack(io = nil)

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

def to_msgpack_ext

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

def to_r

for Time.at
def to_r
  Rational(@sec * 1_000_000_000 + @nsec, 1_000_000_000)
end

def to_s

def to_s
  @sec.to_s
end

def to_time

def to_time
  Time.at(@sec, @nsec, :nanosecond)
end

def to_time

def to_time
  Time.at(@sec, @nsec / 1000.0)
end