Dart DocumentationbsonTimestamp

Timestamp class

class Timestamp extends BsonObject{
 int seconds;
 int increment;
 Timestamp([this.seconds,this.increment]){
   if (seconds == null){
     seconds = (new DateTime.now().millisecondsSinceEpoch ~/ 1000).toInt();
   }
   if (increment == null){
     increment = _Statics.nextIncrement;
   }
 }
 String toString()=>"Timestamp(seconds: $seconds, increment: $increment)";
 int byteLength() => 8;
 packValue(BsonBinary buffer){
   buffer.writeInt(seconds);
   buffer.writeInt(increment);    
 }
 unpackValue(BsonBinary buffer){
    seconds = buffer.readInt32();
    increment = buffer.readInt32();     
 }
}

Extends

BsonObject > Timestamp

Constructors

new Timestamp([int seconds, int increment]) #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
Timestamp([this.seconds,this.increment]){
 if (seconds == null){
   seconds = (new DateTime.now().millisecondsSinceEpoch ~/ 1000).toInt();
 }
 if (increment == null){
   increment = _Statics.nextIncrement;
 }
}

Properties

int increment #

int increment

int seconds #

int seconds

final int typeByte #

inherited from BsonObject
int get typeByte{ throw "must be implemented";}

final value #

inherited from BsonObject
get value=>null;

Methods

int byteLength() #

int byteLength() => 8;

dynamic packElement(String name, buffer) #

inherited from BsonObject
packElement(String name, var buffer){
 buffer.writeByte(typeByte);
 if (name != null){
   new BsonCString(name).packValue(buffer);
 }
 packValue(buffer);
}

dynamic packValue(BsonBinary buffer) #

packValue(BsonBinary buffer){
 buffer.writeInt(seconds);
 buffer.writeInt(increment);    
}

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString()=>"Timestamp(seconds: $seconds, increment: $increment)";

_ElementPair unpackElement(buffer) #

inherited from BsonObject
_ElementPair unpackElement(buffer){
 _ElementPair result = new _ElementPair();
 result.name = buffer.readCString();
 unpackValue(buffer);
 result.value = value;
 return result;
}

dynamic unpackValue(BsonBinary buffer) #

unpackValue(BsonBinary buffer){
  seconds = buffer.readInt32();
  increment = buffer.readInt32();     
}