👒 fix timezone to utc and perfect example demo

This commit is contained in:
Godruoyi
2021-11-26 13:54:11 +08:00
parent 056fce86b8
commit 937cb414e9
2 changed files with 7 additions and 2 deletions

View File

@@ -2,13 +2,18 @@ package main
import (
"fmt"
"time"
"github.com/godruoyi/go-snowflake"
)
func main() {
// set starttime and machineID for the first time if you wan't to use the default value
snowflake.SetStartTime(time.Date(2021, 9, 1, 0, 0, 0, 0, time.UTC))
snowflake.SetMachineID(snowflake.PrivateIPToMachineID()) // testing, not to be used in production
id := snowflake.ID()
fmt.Println(id)
fmt.Println(id) // 1537200202186752
sid := snowflake.ParseID(id)
// SID {