f4b6a3 / tsid-creator

A Java library for generating Time-Sorted Unique Identifiers (TSID).
MIT License
475 stars 50 forks source link

handle clock drift #14

Closed fabiolimace closed 2 years ago

fabiolimace commented 2 years ago

Keep monotonicity in case of small clock drift.

fabiolimace commented 2 years ago

Added a drift tolerance of 10 seconds to preserve monotonicity when the system clock is adjusted by NTP after a small clock drift or when the system clock jumps back by 1 second due to leap second.

The counter is incremented when the current time:

The timestamp is also incremented if the counter is exceeded. Now the TSID factory doesn't have to wait for the next millisecond when the counter overruns. Therefore, there is no longer any speed limit for generating TSIDs.

fabiolimace commented 2 years ago

Released version v4.2.0.

fabiolimace commented 2 years ago

Reopen for final adjustment.

fabiolimace commented 2 years ago

Released version v4.2.1.