Skip to content

Instantly share code, notes, and snippets.

@VisualBean
Created April 2, 2019 20:12
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 VisualBean/162221ae080aa55938401fca8fff26d1 to your computer and use it in GitHub Desktop.
Save VisualBean/162221ae080aa55938401fca8fff26d1 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"time"
)
func timeTrack(start time.Time) {
fmt.Println("Execution time:", time.Since(start))
}
func main() {
sleepyTime()
}
func sleepyTime() {
defer timeTrack(time.Now())
time.Sleep(time.Second * 2)
fmt.Println("Wakey wakey")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment