remove snowflake instances
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
class SnowFlake{
|
||||
abstract class SnowFlake{
|
||||
public readonly id:string;
|
||||
constructor(id:string){
|
||||
this.id=id;
|
||||
}
|
||||
getUnixTime():number{
|
||||
return SnowFlake.stringToUnixTime(this.id);
|
||||
}
|
||||
static stringToUnixTime(str:string){
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user