Skip to content

Instantly share code, notes, and snippets.

@aliforever
Last active April 26, 2019 19:48
Show Gist options
  • Save aliforever/469a239b10046ad6877a999d5e87378a to your computer and use it in GitHub Desktop.
Save aliforever/469a239b10046ad6877a999d5e87378a to your computer and use it in GitHub Desktop.
PHP microtime function equivalent in Golang
// 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