package test import ( "fmt" "time" ) func TTime() { t := time.NewTicker(time.Second * 2) defer t.Stop() i := 0 for i < 5 { select { case <-t.C: fmt.Println(i) i++ } } fmt.Println("time.NewTicker(time.Second * 5)") }