Compare commits

...
2 Commits
Author SHA1 Message Date
Dustin Pianalto 02b5842107 Add milliseconds to timestamp
CI / build (push) Has been cancelled
2021-07-23 12:54:23 -08:00
Dustin Pianalto d345044b3a Add milliseconds to timestamp
CI / build (push) Has been cancelled
2021-07-23 12:39:35 -08:00
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ func ParseDateString(inTime time.Time) string {
} else {
dateString = "Now"
}
stamp := inTime.Format("2006-01-02 15:04:05")
stamp := inTime.Format("2006-01-02 15:04:05.000")
return fmt.Sprintf("%v\n%v", dateString, stamp)
}
+4 -1
View File
@@ -19,7 +19,10 @@ func ParseSnowflake(s int64) Snowflake {
PROCESS_ID_MASK = 0x1F000
INCREMENT_MASK = 0xFFF
)
creationTime := time.Unix(((s>>TIME_BITS_LOC)+DISCORD_EPOCH)/1000.0, 0)
t := (s >> TIME_BITS_LOC) + DISCORD_EPOCH
sec := t / 1000.0
nano := t % 1000.0 * 1000000.0
creationTime := time.Unix(sec, nano)
workerID := (s & WORKER_ID_MASK) >> WORKER_ID_LOC
processID := (s & PROCESS_ID_MASK) >> PROCESS_ID_LOC
increment := s & INCREMENT_MASK