Class: ArrowFormat::Org::Apache::Arrow::Flatbuf::Date

Inherits:
FlatBuffers::Table
  • Object
show all
Defined in:
lib/arrow-format/org/apache/arrow/flatbuf/date.rb

Overview

Date is either a 32-bit or 64-bit signed integer type representing an elapsed time since UNIX epoch (1970-01-01), stored in either of two units:

  • Milliseconds (64 bits) indicating UNIX time elapsed since the epoch (no leap seconds), where the values are evenly divisible by 86400000

  • Days (32 bits) since the UNIX epoch

Constant Summary collapse

FIELDS =
{
  unit: ::FlatBuffers::Field.new(:unit, 0, 4, :short, 0),
}
Data =
define_data_class

Instance Method Summary collapse

Instance Method Details

#unitObject



28
29
30
31
32
33
34
35
36
# File 'lib/arrow-format/org/apache/arrow/flatbuf/date.rb', line 28

def unit
  field_offset = @view.unpack_virtual_offset(4)
  if field_offset.zero?
    enum_value = 1
  else
    enum_value = @view.unpack_short(field_offset)
  end
  ::ArrowFormat::Org::Apache::Arrow::Flatbuf::DateUnit.try_convert(enum_value) || enum_value
end