diff --git a/C++/source/idgen/IdGenerator.h b/C++/source/idgen/IdGenerator.h index 25e3961..98be61e 100644 --- a/C++/source/idgen/IdGenerator.h +++ b/C++/source/idgen/IdGenerator.h @@ -213,7 +213,7 @@ namespace idgen int64_t CalcTurnBackId() { - uint64_t result = (_SnowFlakeWorker._LastTimeTick << _SnowFlakeWorker._TimestampShift) | (_SnowFlakeWorker.WorkerId << _SnowFlakeWorker.SeqBitLength) | + uint64_t result = (_SnowFlakeWorker._TurnBackTimeTick << _SnowFlakeWorker._TimestampShift) | (_SnowFlakeWorker.WorkerId << _SnowFlakeWorker.SeqBitLength) | (_SnowFlakeWorker._TurnBackIndex); _SnowFlakeWorker._TurnBackTimeTick--; return result; diff --git a/C/source/idgen/SnowWorkerM1.c b/C/source/idgen/SnowWorkerM1.c index a990010..f049de7 100644 --- a/C/source/idgen/SnowWorkerM1.c +++ b/C/source/idgen/SnowWorkerM1.c @@ -112,7 +112,7 @@ static inline int64_t CalcId(SnowFlakeWorker *worker) { } static inline int64_t CalcTurnBackId(SnowFlakeWorker *worker) { - uint64_t result = (worker->_LastTimeTick << worker->_TimestampShift) | (worker->WorkerId << worker->SeqBitLength) | + uint64_t result = (worker->_TurnBackTimeTick << worker->_TimestampShift) | (worker->WorkerId << worker->SeqBitLength) | (worker->_TurnBackIndex); worker->_TurnBackTimeTick--; return result; diff --git a/PHP/src/snowflake/snowflake.c b/PHP/src/snowflake/snowflake.c index 4d50e82..af5cede 100644 --- a/PHP/src/snowflake/snowflake.c +++ b/PHP/src/snowflake/snowflake.c @@ -261,7 +261,7 @@ static inline uint64_t CalcId(snowflake *flake) static inline uint64_t CalcTurnBackId(snowflake *flake) { - uint64_t result = (flake->_LastTimeTick << flake->_TimestampShift) + (flake->WorkerId << flake->SeqBitLength) + (flake->_TurnBackIndex ); + uint64_t result = (flake->_TurnBackTimeTick << flake->_TimestampShift) + (flake->WorkerId << flake->SeqBitLength) + (flake->_TurnBackIndex ); flake->_TurnBackTimeTick--; return result; }