@@ -11,9 +11,9 @@ const Long = require('./long');
1111class Timestamp extends Long {
1212 constructor ( low , high ) {
1313 if ( Long . isLong ( low ) ) {
14- super ( low . low , low . high ) ;
14+ super ( low . low , low . high , true ) ;
1515 } else {
16- super ( low , high ) ;
16+ super ( low , high , true ) ;
1717 }
1818 }
1919
@@ -37,7 +37,7 @@ class Timestamp extends Long {
3737 * @return {Timestamp } the timestamp.
3838 */
3939 static fromInt ( value ) {
40- return new Timestamp ( Long . fromInt ( value ) ) ;
40+ return new Timestamp ( Long . fromInt ( value , true ) ) ;
4141 }
4242
4343 /**
@@ -48,7 +48,7 @@ class Timestamp extends Long {
4848 * @return {Timestamp } the timestamp.
4949 */
5050 static fromNumber ( value ) {
51- return new Timestamp ( Long . fromNumber ( value ) ) ;
51+ return new Timestamp ( Long . fromNumber ( value , true ) ) ;
5252 }
5353
5454 /**
@@ -72,14 +72,14 @@ class Timestamp extends Long {
7272 * @return {Timestamp } the timestamp.
7373 */
7474 static fromString ( str , opt_radix ) {
75- return new Timestamp ( Long . fromString ( str , opt_radix ) ) ;
75+ return new Timestamp ( Long . fromString ( str , opt_radix , true ) ) ;
7676 }
7777
7878 /**
7979 * @ignore
8080 */
8181 toExtendedJSON ( ) {
82- return { $timestamp : { t : this . high , i : this . low } } ;
82+ return { $timestamp : { t : this . high >>> 0 , i : this . low >>> 0 } } ;
8383 }
8484
8585 /**
@@ -91,4 +91,7 @@ class Timestamp extends Long {
9191}
9292
9393Object . defineProperty ( Timestamp . prototype , '_bsontype' , { value : 'Timestamp' } ) ;
94+
95+ Timestamp . MAX_VALUE = Timestamp . MAX_UNSIGNED_VALUE ;
96+
9497module . exports = Timestamp ;
0 commit comments