Created
April 2, 2019 20:12
-
-
Save VisualBean/162221ae080aa55938401fca8fff26d1 to your computer and use it in GitHub Desktop.
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
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