Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Golang time function.
func timeTrack(start time.Time, name string) {
elapsed := time.Since(start)
log.Printf("%s took %s", name, elapsed)
}
func factorial(n *big.Int) (result *big.Int) {
defer timeTrack(time.Now(), "factorial")
// ... do some things, maybe even return under some condition
return n
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment