module BSON::TimeWithZone

def _bson_to_i

Other tags:
    Api: - private
def _bson_to_i
  # Workaround for JRuby's #to_i rounding negative timestamps up
  # rather than down (https://github.com/jruby/jruby/issues/6104)
  if BSON::Environment.jruby?
    (self - usec.to_r/1000000).to_i
  else
    to_i
  end
end

def bson_type

the BSON type for time.
As the ActiveSupport::TimeWithZone is converted to a time, this returns

Get the BSON type for the ActiveSupport::TimeWithZone.
def bson_type
  ::Time::BSON_TYPE
end

def to_bson(buffer = ByteBuffer.new)

Other tags:
    Since: - 4.4.0

Other tags:
    See: http://bsonspec.org/#/specification -

Returns:
  • (BSON::ByteBuffer) - The buffer with the encoded object.

Other tags:
    Example: Get the ActiveSupport::TimeWithZone as encoded BSON. -
def to_bson(buffer = ByteBuffer.new)
  buffer.put_int64((to_i * 1000) + (usec / 1000))
end