remove snowflake instances
This commit is contained in:
parent
004beb4955
commit
e66b6c0883
16 changed files with 97 additions and 149 deletions
|
@ -4,11 +4,14 @@ class SnowFlake {
|
|||
this.id = id;
|
||||
}
|
||||
getUnixTime() {
|
||||
return SnowFlake.stringToUnixTime(this.id);
|
||||
}
|
||||
static stringToUnixTime(str) {
|
||||
try {
|
||||
return Number((BigInt(this.id) >> 22n) + 1420070400000n);
|
||||
return Number((BigInt(str) >> 22n) + 1420070400000n);
|
||||
}
|
||||
catch {
|
||||
console.error(`The ID is corrupted, it's ${this.id} when it should be some number.`);
|
||||
console.error(`The ID is corrupted, it's ${str} when it should be some number.`);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue