File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
redisinsight/ui/src/utils/formatters Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ export default class JavaDate implements JavaSerializable {
7
7
// The serial version UID followed for 'java.util.Date'
8
8
static readonly SerialVersionUID = '7523967970034938905'
9
9
10
+ // The maximum value for a Java long
11
+ readonly JAVA_MAX_LONG = 9223372036854775807n // 2^63 - 1
12
+
13
+ // The maximum value for a two's complement long
14
+ readonly TWO_COMPLEMENT_MAX_LONG = 18446744073709551616n // 2^64
15
+
10
16
time : bigint = 0n
11
17
12
18
readObject ( stream : ObjectInputStream ) : void {
@@ -17,9 +23,9 @@ export default class JavaDate implements JavaSerializable {
17
23
let timeValue : number
18
24
19
25
// Handle two's complement conversion for negative numbers
20
- if ( this . time > 9223372036854775807n ) {
26
+ if ( this . time > this . JAVA_MAX_LONG ) {
21
27
// If the number is larger than MAX_LONG, it's a negative number in two's complement
22
- timeValue = Number ( this . time - 18446744073709551616n )
28
+ timeValue = Number ( this . time - this . TWO_COMPLEMENT_MAX_LONG )
23
29
} else {
24
30
timeValue = Number ( this . time )
25
31
}
You can’t perform that action at this time.
0 commit comments