Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (20 sloc) 346 Bytes
package main
import (
"flag"
"fmt"
"time"
)
var duration time.Duration
func init() {
flag.DurationVar(&duration, "duration", time.Millisecond, "how long to sleep")
}
func main() {
flag.Parse()
for {
start := time.Now()
timer := time.NewTimer(duration)
<-timer.C
end := time.Now()
fmt.Println(end.Sub(start) - duration)
}
}
You can’t perform that action at this time.