Skip to content

Instantly share code, notes, and snippets.

@sneak
Created September 22, 2020 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sneak/e654be7e65d11907c3aab5720adf1c52 to your computer and use it in GitHub Desktop.
Save sneak/e654be7e65d11907c3aab5720adf1c52 to your computer and use it in GitHub Desktop.
webkit time conversion
package main
import (
"fmt"
"time"
)
func main() {
//2020-09-21 22:49:02
const wk int64 = 13245202142853170
const correctedMicros int64 = wk - (11644473600 * 1000000)
const wholeSeconds int64 = correctedMicros / 1000000
const remainderMicros int64 = correctedMicros - (wholeSeconds * 1000000)
const remainderNanos int64 = remainderMicros * 1000
t := time.Unix(wholeSeconds, remainderNanos)
fmt.Println(t.UTC().String())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment