Created
September 22, 2020 00:19
-
-
Save sneak/e654be7e65d11907c3aab5720adf1c52 to your computer and use it in GitHub Desktop.
webkit time conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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