@@ -11,9 +11,9 @@ const Long = require('./long');
11
11
class Timestamp extends Long {
12
12
constructor ( low , high ) {
13
13
if ( Long . isLong ( low ) ) {
14
- super ( low . low , low . high ) ;
14
+ super ( low . low , low . high , true ) ;
15
15
} else {
16
- super ( low , high ) ;
16
+ super ( low , high , true ) ;
17
17
}
18
18
}
19
19
@@ -37,7 +37,7 @@ class Timestamp extends Long {
37
37
* @return {Timestamp } the timestamp.
38
38
*/
39
39
static fromInt ( value ) {
40
- return new Timestamp ( Long . fromInt ( value ) ) ;
40
+ return new Timestamp ( Long . fromInt ( value , true ) ) ;
41
41
}
42
42
43
43
/**
@@ -48,7 +48,7 @@ class Timestamp extends Long {
48
48
* @return {Timestamp } the timestamp.
49
49
*/
50
50
static fromNumber ( value ) {
51
- return new Timestamp ( Long . fromNumber ( value ) ) ;
51
+ return new Timestamp ( Long . fromNumber ( value , true ) ) ;
52
52
}
53
53
54
54
/**
@@ -72,14 +72,14 @@ class Timestamp extends Long {
72
72
* @return {Timestamp } the timestamp.
73
73
*/
74
74
static fromString ( str , opt_radix ) {
75
- return new Timestamp ( Long . fromString ( str , opt_radix ) ) ;
75
+ return new Timestamp ( Long . fromString ( str , opt_radix , true ) ) ;
76
76
}
77
77
78
78
/**
79
79
* @ignore
80
80
*/
81
81
toExtendedJSON ( ) {
82
- return { $timestamp : { t : this . high , i : this . low } } ;
82
+ return { $timestamp : { t : this . high >>> 0 , i : this . low >>> 0 } } ;
83
83
}
84
84
85
85
/**
@@ -91,4 +91,7 @@ class Timestamp extends Long {
91
91
}
92
92
93
93
Object . defineProperty ( Timestamp . prototype , '_bsontype' , { value : 'Timestamp' } ) ;
94
+
95
+ Timestamp . MAX_VALUE = Timestamp . MAX_UNSIGNED_VALUE ;
96
+
94
97
module . exports = Timestamp ;
0 commit comments