In Files

Namespace

Methods

BSON::Time

Injects behaviour for encoding and decoding time values to and from raw bytes as specified by the BSON spec.

@see bsonspec.org/#/specification

@since 2.0.0

Constants

BSON_TYPE

A time is type 0x09 in the BSON spec.

@since 2.0.0

Public Instance Methods

to_bson(encoded = ''.force_encoding(BINARY)) click to toggle source

Get the time as encoded BSON.

@example Get the time as encoded BSON.

Time.new(2012, 1, 1, 0, 0, 0).to_bson

@return [ String ] The encoded string.

@see bsonspec.org/#/specification

@since 2.0.0

# File lib/bson/time.rb, line 40
def to_bson(encoded = ''.force_encoding(BINARY))
  encoded << [ (to_f * 1000.0).to_i ].pack(Int64::PACK)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.