new Timestamp(low, high)
This type is for INTERNAL use in MongoDB only and should not be used in applications.
The appropriate corresponding type is the JavaScript Date type.
Defines a Timestamp class for representing a 64bit two'scomplement
integer value, which faithfully simulates the behavior of a Java "Timestamp". This
implementation is derived from TimestampLib in GWT.
Constructs a 64bit two'scomplement integer, given its low and high 32bit
values as signed integers. See the from* functions below for more
convenient ways of constructing Timestamps.
The internal representation of a Timestamp is the two given signed, 32bit values.
We use 32bit pieces because these are the size of integers on which
Javascript performs bitoperations. For operations like addition and
multiplication, we split each number into 16bit pieces, which can easily be
multiplied within Javascript's floatingpoint representation without overflow
or change in sign.
In the algorithms below, we frequently reduce the negative case to the
positive case by negating the input(s) and then postprocessing the result.
Note that we must ALWAYS check specially whether those values are MIN_VALUE
(2^63) because MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as
a positive number, it overflows back into a negative). Not handling this
case would often result in infinite recursion.
Name  Type  Description 

low 
number 
the low (signed) 32 bits of the Timestamp. 
high 
number 
the high (signed) 32 bits of the Timestamp. 
Members

staticTimestamp.MAX_VALUE


staticTimestamp.MIN_VALUE


staticTimestamp.NEG_ONE


staticTimestamp.ONE


staticTimestamp.ZERO

Methods

staticTimestamp.fromBits(lowBits, highBits){Timestamp}

Returns a Timestamp representing the 64bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
Name Type Description lowBits
number the low 32bits.
highBits
number the high 32bits.
Returns:
corresponding Timestamp value.

staticTimestamp.fromInt(value){Timestamp}

Returns a Timestamp representing the given (32bit) integer value.
Name Type Description value
number the 32bit integer in question.
Returns:
corresponding Timestamp value.

staticTimestamp.fromNumber(value){Timestamp}

Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned.
Name Type Description value
number the number in question.
Returns:
corresponding Timestamp value.

staticTimestamp.fromString(str, opt_radix){Timestamp}

Returns a Timestamp representation of the given string, written using the given radix.
Name Type Description str
string the textual representation of the Timestamp.
opt_radix
number the radix in which the text is written.
Returns:
corresponding Timestamp value.

add(other){Timestamp}

Returns the sum of this and the given Timestamp.
Name Type Description other
Timestamp Timestamp to add to this one.
Returns:
sum of this and the given Timestamp.

and(other){Timestamp}

Returns the bitwiseAND of this Timestamp and the given one.
Name Type Description other
Timestamp the Timestamp with which to AND.
Returns:
bitwiseAND of this and the other.

compare(other){boolean}

Compares this Timestamp with the given one.
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
if they are the same, 1 if the this is greater, and 1 if the given one is greater.

div(other){Timestamp}

Returns this Timestamp divided by the given one.
Name Type Description other
Timestamp Timestamp by which to divide.
Returns:
Timestamp divided by the given one.

equals(other){boolean}

Return whether this Timestamp equals the other
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
this Timestamp equals the other

getHighBits(){number}

Return the high 32bits value.
Returns:
high 32bits as a signed value.

getLowBits(){number}

Return the low 32bits value.
Returns:
low 32bits as a signed value.

getLowBitsUnsigned(){number}

Return the low unsigned 32bits value.
Returns:
low 32bits as an unsigned value.

getNumBitsAbs(){number}

Returns the number of bits needed to represent the absolute value of this Timestamp.
Returns:
the number of bits needed to represent the absolute value of this Timestamp.

greaterThan(other){boolean}

Return whether this Timestamp is greater than the other.
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
this Timestamp is greater than the other.

greaterThanOrEqual(other){boolean}

Return whether this Timestamp is greater than or equal to the other.
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
this Timestamp is greater than or equal to the other.

isNegative(){boolean}

Return whether this value is negative.
Returns:
this value is negative.

isOdd(){boolean}

Return whether this value is odd.
Returns:
this value is odd.

isZero(){boolean}

Return whether this value is zero.
Returns:
this value is zero.

lessThan(other){boolean}

Return whether this Timestamp is less than the other.
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
this Timestamp is less than the other.

lessThanOrEqual(other){boolean}

Return whether this Timestamp is less than or equal to the other.
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
this Timestamp is less than or equal to the other.

modulo(other){Timestamp}

Returns this Timestamp modulo the given one.
Name Type Description other
Timestamp Timestamp by which to mod.
Returns:
Timestamp modulo the given one.

multiply(other){Timestamp}

Returns the product of this and the given Timestamp.
Name Type Description other
Timestamp Timestamp to multiply with this.
Returns:
product of this and the other.

The negation of this value.
Returns:
negation of this value.

The bitwiseNOT of this value.
Returns:
bitwiseNOT of this value.

notEquals(other){boolean}

Return whether this Timestamp does not equal the other.
Name Type Description other
Timestamp Timestamp to compare against.
Returns:
this Timestamp does not equal the other.

or(other){Timestamp}

Returns the bitwiseOR of this Timestamp and the given one.
Name Type Description other
Timestamp the Timestamp with which to OR.
Returns:
bitwiseOR of this and the other.

shiftLeft(numBits){Timestamp}

Returns this Timestamp with bits shifted to the left by the given amount.
Name Type Description numBits
number the number of bits by which to shift.
Returns:
shifted to the left by the given amount.

shiftRight(numBits){Timestamp}

Returns this Timestamp with bits shifted to the right by the given amount.
Name Type Description numBits
number the number of bits by which to shift.
Returns:
shifted to the right by the given amount.

shiftRightUnsigned(numBits){Timestamp}

Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit.
Name Type Description numBits
number the number of bits by which to shift.
Returns:
shifted to the right by the given amount, with zeros placed into the new leading bits.

subtract(other){Timestamp}

Returns the difference of this and the given Timestamp.
Name Type Description other
Timestamp Timestamp to subtract from this.
Returns:
difference of this and the given Timestamp.

toInt(){number}

Return the int value.
Returns:
value, assuming it is a 32bit integer.

toJSON(){string}

Return the JSON value.
Returns:
JSON representation.

toNumber(){number}

Return the Number value.
Returns:
closest floatingpoint representation to this value.

toString(opt_radix){string}

Return the String value.
Name Type Description opt_radix
number optional the radix in which the text should be written.
Returns:
textual representation of this value.

xor(other){Timestamp}

Returns the bitwiseXOR of this Timestamp and the given one.
Name Type Description other
Timestamp the Timestamp with which to XOR.
Returns:
bitwiseXOR of this and the other.