Sha256: 14d1271e0ee73646a923e92946b9b98d279b572dd327de6ac47ec832649f698f

Contents?: true

Size: 495 Bytes

Versions: 22

Compression:

Stored size: 495 Bytes

Contents

module Moped
  module BSON
    # @private
    module Extensions
      module Time
        module ClassMethods
          def __bson_load__(io)
            seconds, fragment = io.read(8).unpack(INT64_PACK)[0].divmod 1000
            at(seconds, fragment * 1000).utc
          end
        end

        def __bson_dump__(io, key)
          io << Types::TIME
          io << key.to_bson_cstring
          io << [(to_i * 1000) + (usec / 1000)].pack(INT64_PACK)
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/moped-1.3.2/lib/moped/bson/extensions/time.rb
moped-1.3.2 lib/moped/bson/extensions/time.rb
moped-1.3.1 lib/moped/bson/extensions/time.rb
moped-1.3.0 lib/moped/bson/extensions/time.rb
moped-1.2.9 lib/moped/bson/extensions/time.rb
moped-1.2.8 lib/moped/bson/extensions/time.rb
moped-1.2.7 lib/moped/bson/extensions/time.rb
moped-1.2.6 lib/moped/bson/extensions/time.rb
moped-1.2.5 lib/moped/bson/extensions/time.rb
moped-1.2.4 lib/moped/bson/extensions/time.rb
moped-1.2.2 lib/moped/bson/extensions/time.rb
moped-1.2.1 lib/moped/bson/extensions/time.rb
moped-1.2.0 lib/moped/bson/extensions/time.rb
moped-1.1.6 lib/moped/bson/extensions/time.rb
moped-1.1.5 lib/moped/bson/extensions/time.rb
moped-1.1.4 lib/moped/bson/extensions/time.rb
moped-1.1.3 lib/moped/bson/extensions/time.rb
moped-1.1.2 lib/moped/bson/extensions/time.rb
moped-1.0.1 lib/moped/bson/extensions/time.rb
moped-1.1.1 lib/moped/bson/extensions/time.rb