Skip to content

Commit

Permalink
fix the typo
Browse files Browse the repository at this point in the history
  • Loading branch information
hbin committed Jun 24, 2018
1 parent 0ba6b18 commit 20e26ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ func ToID(t time.Time) uint64 {
}

// Dump returns the structure of id.
func Dump(id uint64) (t time.Time, workerID uint64, sequense uint64) {
func Dump(id uint64) (t time.Time, workerID uint64, sequence uint64) {
workerID = (id & (workerIDMask << SequenceBits)) >> SequenceBits
sequense = id & sequenseMask
return ToTime(id), workerID, sequense
sequence = id & sequenceMask
return ToTime(id), workerID, sequence
}
4 changes: 2 additions & 2 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const (
WorkerIDBits = 10
SequenceBits = 12
workerIDMask = -1 ^ (-1 << WorkerIDBits)
sequenseMask = -1 ^ (-1 << SequenceBits)
sequenceMask = -1 ^ (-1 << SequenceBits)
)

var workerIDPool = []uint{}
Expand Down Expand Up @@ -109,7 +109,7 @@ func (g *generator) NextID() (uint64, error) {
}

if ts == g.lastTimestamp {
g.sequence = (g.sequence + 1) & sequenseMask
g.sequence = (g.sequence + 1) & sequenceMask
if g.sequence == 0 {
// overflow
ts = g.waitUntilNextTick(ts)
Expand Down

0 comments on commit 20e26ee

Please sign in to comment.