Golang time.NewTicker(), Stop() functions and Ticker type example
package time
Golang time.NewTicker(), Stop() functions and Ticker type usage example
package main
import (
"fmt"
"time"
)
const Count = 10
func main() {
Delta := 100 * time.Millisecond
ticker := time.NewTicker(Delta)
for i := 0; i < Count; i++ {
<-ticker.C
fmt.Println("tick")
}
ticker.Stop()
}
References :
http://golang.org/pkg/time/#Ticker
Advertisement
Something interesting
Tutorials
+13.9k Golang : rune literal not terminated error
+27.9k Golang : Get time.Duration in year, month, week or day
+14.6k Golang : Read a file line by line
+9.4k Golang : Create matrix with Gonum Matrix package example
+10.5k Golang : Setup API server or gateway with Caddy and http.ListenAndServe() function example
+5.3k Grep : How to grep for strings inside binary data
+17.2k Golang : Check whether a network interface is up on your machine
+10k Google Maps URL parameters configuration
+6.5k Golang : Convert source code to assembly language
+50.2k Golang : How to get struct field and value by name
+7.7k Golang : Heap sort example