|
|
@ -9,7 +9,7 @@ public class SnowflakeIdGenerate implements IdGenerate<Long> { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 开始时间戳 |
|
|
|
* 开始时间戳 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private final long twepoch = 1420041600000L; |
|
|
|
private final long TWEPOCH = 1420041600000L; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 机器id所占的位数 |
|
|
|
* 机器id所占的位数 |
|
|
@ -107,7 +107,7 @@ public class SnowflakeIdGenerate implements IdGenerate<Long> { |
|
|
|
} |
|
|
|
} |
|
|
|
//上次生成ID的时间戳
|
|
|
|
//上次生成ID的时间戳
|
|
|
|
lastTimeStamp = timestamp; |
|
|
|
lastTimeStamp = timestamp; |
|
|
|
return ((timestamp-twepoch)<<timestampLeftShift) |
|
|
|
return ((timestamp-TWEPOCH)<<timestampLeftShift) |
|
|
|
|(dataCenterId<<dataCenterIdShift) |
|
|
|
|(dataCenterId<<dataCenterIdShift) |
|
|
|
|(workerId<<workerIdShift) |
|
|
|
|(workerId<<workerIdShift) |
|
|
|
|sequence; |
|
|
|
|sequence; |
|
|
|