mirror of
https://github.com/RussellChamp/advent-of-code-2021.git
synced 2026-10-27 21:52:32 +00:00
19 lines
220 B
Go
19 lines
220 B
Go
package timer
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
var lastTime time.Time
|
|
|
|
func Start() {
|
|
lastTime = time.Now()
|
|
}
|
|
|
|
func Tick() {
|
|
now := time.Now()
|
|
fmt.Printf("[Time taken: %s]\n", now.Sub(lastTime).String())
|
|
lastTime = now
|
|
}
|