5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-09-20 06:42:31 +00:00
matterbridge/vendor/github.com/bwmarrin/discordgo/util.go
Wim 0bc159341d
Update vendor (#932)
* Update vendor

* Fix godiscord api change
2019-10-27 01:45:57 +02:00

18 lines
368 B
Go

package discordgo
import (
"strconv"
"time"
)
// SnowflakeTimestamp returns the creation time of a Snowflake ID relative to the creation of Discord.
func SnowflakeTimestamp(ID string) (t time.Time, err error) {
i, err := strconv.ParseInt(ID, 10, 64)
if err != nil {
return
}
timestamp := (i >> 22) + 1420070400000
t = time.Unix(timestamp/1000, 0)
return
}