diff --git a/sonyflake.go b/sonyflake.go index 1c1402e..b0c02f5 100644 --- a/sonyflake.go +++ b/sonyflake.go @@ -89,12 +89,16 @@ func NewSonyflake(st Settings) *Sonyflake { // NextID generates a next unique ID. // After the Sonyflake time overflows, NextID returns an error. func (sf *Sonyflake) NextID() (uint64, error) { + return sf.NextIDWithCustomNow(time.Now()) +} + +func (sf *Sonyflake) NextIDWithCustomNow(now time.Time) (uint64, error) { const maskSequence = uint16(1<