Last active
April 26, 2019 19:48
-
-
Save aliforever/469a239b10046ad6877a999d5e87378a to your computer and use it in GitHub Desktop.
PHP microtime function equivalent in Golang
This file contains 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
// Golang microtime | |
// Php microtime in golang, go | |
func microTime() float64 { | |
loc, _ := time.LoadLocation("GMT") | |
now := time.Now().In(loc) | |
micSeconds := float64(now.Nanosecond()) / 1000000000 | |
return float64(now.Unix()) + micSeconds | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment