class Innodb::DataType::TimeType

Attributes

name[R]
width[R]

Public Class Methods

new(base_type, modifiers, properties) click to toggle source
# File lib/innodb/data_type.rb, line 275
def initialize(base_type, modifiers, properties)
  @width = 3
  @name = Innodb::DataType.make_name(base_type, modifiers, properties)
end

Public Instance Methods

value(data) click to toggle source
# File lib/innodb/data_type.rb, line 280
def value(data)
  time = BinData::Int24be.read(data) ^ (-1 << 23)
  sign = "-" if time.negative?
  time = time.abs
  "%s%02d:%02d:%02d" % [sign, time / 10_000, (time / 100) % 100, time % 100]
end