mirror of
https://github.com/godruoyi/go-snowflake.git
synced 2025-12-23 05:25:15 +00:00
👼 Default start time change to 2008-11-10 23:00:00 UTC
This commit is contained in:
@@ -25,13 +25,14 @@ const (
|
||||
// AtomicResolver : base sync/atomic (by default).
|
||||
type SequenceResolver func(ms int64) (uint16, error)
|
||||
|
||||
// default start time is 2014-09-01 00:00:00UTC
|
||||
// default start time is 2008-11-10 23:00:00 UTC, why ? In the playground the time begins at 2009-11-10 23:00:00 UTC.
|
||||
// It's can run on golang playground.
|
||||
// default machineID is 0
|
||||
// default resolver is AtomicResolver
|
||||
var (
|
||||
resolver SequenceResolver
|
||||
machineID = 0
|
||||
startTime = time.Date(2014, 9, 1, 0, 0, 0, 0, time.UTC)
|
||||
startTime = time.Date(2008, 11, 10, 23, 0, 0, 0, time.UTC)
|
||||
)
|
||||
|
||||
// ID use ID to generate snowflake id and it will ignore error. if you want error info, you need use NextID method.
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestSetStartTime(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Default start time", func(tt *testing.T) {
|
||||
defaultTime := time.Date(2014, 9, 1, 0, 0, 0, 0, time.UTC)
|
||||
defaultTime := time.Date(2008, 11, 10, 23, 0, 0, 0, time.UTC)
|
||||
defaultNano := defaultTime.UTC().UnixNano() / 1e6
|
||||
|
||||
sid := snowflake.ParseID(snowflake.ID())
|
||||
|
||||
Reference in New Issue
Block a user